Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #53 from amagar088/MarketingCloudSDK
Browse files Browse the repository at this point in the history
Renamed FuelSDk to MarketingCloudSDK
  • Loading branch information
amagar088 authored Oct 25, 2016
2 parents 72f97ab + 51df16d commit 428253d
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 171 deletions.
45 changes: 23 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PATH
remote: .
specs:
fuelsdk (0.0.6)
json (~> 1.8.1)
jwt (~> 1.0.0)
marketingcloudsdk (1.0.0)
json (~> 1.8, >= 1.8.1)
jwt (~> 1.0, >= 1.0.0)
savon (= 2.2.0)

GEM
remote: https://rubygems.org/
specs:
akami (1.2.2)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
nokogiri
builder (3.2.2)
coderay (1.0.9)
diff-lcs (1.2.4)
Expand All @@ -23,34 +23,32 @@ GEM
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
thor (>= 0.14.6)
guard-rspec (3.0.2)
guard (>= 1.8)
rspec (~> 2.13)
guard-rspec (2.0.0)
guard (>= 1.1)
rspec (~> 2.11)
gyoku (1.0.0)
builder (>= 2.1.2)
httpi (2.0.2)
rack
json (1.8.2)
jwt (0.1.13)
multi_json (>= 1.5)
json (1.8.1)
jwt (1.5.6)
listen (1.3.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
lumberjack (1.0.4)
method_source (0.8.2)
mini_portile (0.6.2)
multi_json (1.11.0)
nokogiri (1.6.0-x86-mingw32)
mini_portile (~> 0.5.0)
mini_portile2 (2.1.0)
nokogiri (1.6.8.1-x86-mingw32)
mini_portile2 (~> 2.1.0)
nori (2.1.0)
pry (0.9.12.2-x86-mingw32)
pry (0.9.10-x86-mingw32)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
win32console (~> 1.3)
rack (1.6.1)
rake (10.1.0)
rack (2.0.1)
rake (0.9.6)
rb-fsevent (0.9.3)
rb-inotify (0.9.1)
ffi (>= 0.5.0)
Expand Down Expand Up @@ -84,8 +82,11 @@ PLATFORMS

DEPENDENCIES
bundler (~> 1.3)
fuelsdk!
guard (~> 0)
guard-rspec (~> 0)
rake (~> 0)
rspec (~> 2)
guard (~> 1.1)
guard-rspec (~> 2.0)
marketingcloudsdk!
rake (~> 0.9)
rspec (~> 2.0)

BUNDLED WITH
1.13.5
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FuelSDK-Ruby
============
FuelSDK-Ruby / MarketingCloudSDK-Ruby
=====================================

ExactTarget Fuel SDK for Ruby
ExactTarget Fuel SDK / SalesforceMarektingCloudSDK for Ruby

## Overview ##
The Fuel SDK for Ruby provides easy access to ExactTarget's Fuel API Family services, including a collection of REST APIs and a SOAP API. These APIs provide access to ExactTarget functionality via common collection types such as array/hash.

## Migrationg to version to version 1.0 ##
- **FuelSDK gem has been renamed to MarketingCloudSDK and will be availbale as marketingcloudsdk on ruby gems.

## New Features in Version .9 ##
- **Streamlined Folder Support**: All objects that support folders within the UI now have a standardized property called folderId.
- **Interaction Support**: Now supports Import and Email::SendDefinition objects .
Expand All @@ -16,41 +19,41 @@ The Fuel SDK for Ruby provides easy access to ExactTarget's Fuel API Family serv
- **Greater Flexibility for Authentication**:Yaml config file is no longer required in order to define the authentication parameters. They are now required inputs when instantiating the Client class so they can be stored anywhere.

## Migrating from old version ##
- FuelSDK is now a Gem. All references to require 'ET_Client.rb' will need to be replaced with a reference to the fuelsdk gem.
- MarkeitngCloudSDK is now gem, Going forward FuelSDK gem will be available as marketingcloudsdk on ruby gems.
- Config.yaml is no longer used. ClientID/ClientSecret will now need to be passed when instantiating the Client class.
- Previous versions of the Fuel SDK exposed objects with the prefix "ET_". For backwards compatibility you can still access objects this way.
Subscriber can be accessed using FuelSDK::Subscriber or ET_Subscriber.
- Previous versions of the SalesforceMarketingCloudSDK exposed objects with the prefix "ET_". For backwards compatibility you can still access objects this way.
Subscriber can be accessed using MarketingCloudSDK::Subscriber or ET_Subscriber.

## Requirements ##
- Ruby Version 1.9.3
- Ruby Version 2.2.5
- Savon 2.2.0

## Getting Started ##
Build the gem from the source

```ruby
gem build fuelsdk.gemspec
gem build marketingcloudsdk.gemspec
```

Install the newly built gem

```ruby
gem install fuelsdk-0.0.5.gem
gem install marketingcloudsdk-1.0.0.gem
```

If you have not registered your application or you need to lookup your Application Key or Application Signature values, please go to App Center at [Code@: ExactTarget's Developer Community](http://code.exacttarget.com/appcenter "Code@ App Center").


## Example Request ##

Add a require statement to reference the Fuel SDK's functionality:
> require 'fuelsdk'
Add a require statement to reference the SalesforceMarketingCloud SDK's functionality:
> require 'marketingcloudsdk'
Next, create an instance of the Client class:
> myClient = FuelSDK::Client.new {'client' => { 'id' => CLIENTID, 'secret' => SECRET }}
> myClient = MarketingCloudSDK::Client.new {'client' => { 'id' => CLIENTID, 'secret' => SECRET }}
Create an instance of the object type we want to work with:
> list = FuelSDK::List.new
> list = MarketingCloudSDK::List.new
Associate the Client to the object using the client property:
> list.client = myClient
Expand All @@ -64,7 +67,7 @@ Print out the results for viewing
**Example Output:**

<pre>
<FuelSDK::SoapResponse:0x007fb86abcf190
<MarketingCloudSDK::SoapResponse:0x007fb86abcf190
@body= {:retrieve_response_msg=> {:overall_status=>"OK", :request_id=>"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", :results=>..}
@code= 200,
@message= 'OK',
Expand Down Expand Up @@ -98,17 +101,17 @@ Client class accepts multiple parameters
**Parameters** - Allows for passing authentication information for use with SSO with a JWT or for passing ClientID/ClientSecret:

Example passing ClientID/ClientSecret:
> myclient = FuelSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret'}})
> myclient = MarketingCloudSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret'}})
Example passing ClientID/ClientSecret/AppSignature/JWT:
> myclient = FuelSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret', 'signature'=>'examplesig'}, 'jwt'=>'exampleJWT'})
> myclient = MarketingCloudSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret', 'signature'=>'examplesig'}, 'jwt'=>'exampleJWT'})
**Debug** - If 2nd parameter for debug is set to true, all API requests that the Fuel SDK is making behind the scenes will be logged. This option should only be set to true in order to troubleshoot during the development process and should never be used in a production scenario.
> myclient = FuelSDK::Client.new auth, true <br>
> myclient = MarketingCloudSDK::Client.new auth, true <br>

## Responses ##
All methods on Fuel SDK objects return a generic object that follows the same structure, regardless of the type of call. This object contains a common set of properties used to display details about the request.
All methods on MarketingCloud SDK objects return a generic object that follows the same structure, regardless of the type of call. This object contains a common set of properties used to display details about the request.

- success?: Boolean value that indicates if the call was successful
- code: HTTP Error Code (will always be 200 for SOAP requests)
Expand Down
60 changes: 30 additions & 30 deletions lib/fuelsdk.rb → lib/marketingcloudsdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,41 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=end

require "fuelsdk/version"
require "marketingcloudsdk/version"

require 'rubygems'
require 'date'
require 'jwt'

module FuelSDK
require 'fuelsdk/utils'
autoload :HTTPRequest, 'fuelsdk/http_request'
autoload :Targeting, 'fuelsdk/targeting'
autoload :Soap, 'fuelsdk/soap'
autoload :Rest, 'fuelsdk/rest'
require 'fuelsdk/client'
require 'fuelsdk/objects'
module MarketingCloudSDK
require 'marketingcloudsdk/utils'
autoload :HTTPRequest, 'marketingcloudsdk/http_request'
autoload :Targeting, 'marketingcloudsdk/targeting'
autoload :Soap, 'marketingcloudsdk/soap'
autoload :Rest, 'marketingcloudsdk/rest'
require 'marketingcloudsdk/client'
require 'marketingcloudsdk/objects'
end

# backwards compatability
ET_Client = FuelSDK::Client
ET_BounceEvent = FuelSDK::BounceEvent
ET_ClickEvent = FuelSDK::ClickEvent
ET_ContentArea = FuelSDK::ContentArea
ET_DataExtension = FuelSDK::DataExtension
ET_DataFolder = FuelSDK::DataFolder
ET_Folder = FuelSDK::Folder
ET_Email = FuelSDK::Email
ET_List = FuelSDK::List
ET_OpenEvent = FuelSDK::OpenEvent
ET_SentEvent = FuelSDK::SentEvent
ET_Subscriber = FuelSDK::Subscriber
ET_UnsubEvent = FuelSDK::UnsubEvent
ET_TriggeredSend = FuelSDK::TriggeredSend
ET_Campaign = FuelSDK::Campaign
ET_Get = FuelSDK::Get
ET_Post = FuelSDK::Post
ET_Delete = FuelSDK::Delete
ET_Patch = FuelSDK::Patch
ET_ProfileAttribute = FuelSDK::ProfileAttribute
ET_Import = FuelSDK::Import
ET_Client = MarketingCloudSDK::Client
ET_BounceEvent = MarketingCloudSDK::BounceEvent
ET_ClickEvent = MarketingCloudSDK::ClickEvent
ET_ContentArea = MarketingCloudSDK::ContentArea
ET_DataExtension = MarketingCloudSDK::DataExtension
ET_DataFolder = MarketingCloudSDK::DataFolder
ET_Folder = MarketingCloudSDK::Folder
ET_Email = MarketingCloudSDK::Email
ET_List = MarketingCloudSDK::List
ET_OpenEvent = MarketingCloudSDK::OpenEvent
ET_SentEvent = MarketingCloudSDK::SentEvent
ET_Subscriber = MarketingCloudSDK::Subscriber
ET_UnsubEvent = MarketingCloudSDK::UnsubEvent
ET_TriggeredSend = MarketingCloudSDK::TriggeredSend
ET_Campaign = MarketingCloudSDK::Campaign
ET_Get = MarketingCloudSDK::Get
ET_Post = MarketingCloudSDK::Post
ET_Delete = MarketingCloudSDK::Delete
ET_Patch = MarketingCloudSDK::Patch
ET_ProfileAttribute = MarketingCloudSDK::ProfileAttribute
ET_Import = MarketingCloudSDK::Import
10 changes: 5 additions & 5 deletions lib/fuelsdk/client.rb → lib/marketingcloudsdk/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
=end

require 'securerandom'
module FuelSDK
module MarketingCloudSDK
class Response
# not doing accessor so user, can't update these values from response.
# You will see in the code some of these
Expand Down Expand Up @@ -79,8 +79,8 @@ class Client
attr_accessor :debug, :access_token, :auth_token, :internal_token, :refresh_token,
:id, :secret, :signature, :package_name, :package_folders, :parent_folders, :auth_token_expiration, :request_token_url

include FuelSDK::Soap
include FuelSDK::Rest
include MarketingCloudSDK::Soap
include MarketingCloudSDK::Rest

def jwt= encoded_jwt
raise 'Require app signature to decode JWT' unless self.signature
Expand Down Expand Up @@ -146,7 +146,7 @@ def refresh!
end

def AddSubscriberToList(email, ids, subscriber_key = nil)
s = FuelSDK::Subscriber.new
s = MarketingCloudSDK::Subscriber.new
s.client = self
lists = ids.collect{|id| {'ID' => id}}
s.properties = {"EmailAddress" => email, "Lists" => lists}
Expand All @@ -162,7 +162,7 @@ def AddSubscriberToList(email, ids, subscriber_key = nil)
end

def CreateDataExtensions(definitions)
de = FuelSDK::DataExtension.new
de = MarketingCloudSDK::DataExtension.new
de.client = self
de.properties = definitions
de.post
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
require 'net/https'
require 'json'

module FuelSDK
module MarketingCloudSDK

class HTTPResponse < FuelSDK::Response
class HTTPResponse < MarketingCloudSDK::Response
def initialize raw, client, request
super raw, client
@request = request
Expand Down
10 changes: 5 additions & 5 deletions lib/fuelsdk/objects.rb → lib/marketingcloudsdk/objects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=end

module FuelSDK
module MarketingCloudSDK
module Objects
module Soap
module Read
Expand Down Expand Up @@ -505,7 +505,7 @@ def munge_keys d
unless explicit_properties(o)
o.each do |k, v|
next if k == 'CustomerKey'
formatted.concat FuelSDK.format_name_value_pairs k => v
formatted.concat MarketingCloudSDK.format_name_value_pairs k => v
o.delete k
end
o['Keys'] = {'Key' => formatted }
Expand All @@ -515,7 +515,7 @@ def munge_keys d
formatted = []
d.each do |k, v|
next if k == 'CustomerKey'
formatted.concat FuelSDK.format_name_value_pairs k => v
formatted.concat MarketingCloudSDK.format_name_value_pairs k => v
d.delete k
end
d['CustomerKey'] = customer_key
Expand All @@ -537,7 +537,7 @@ def munge_properties d
unless explicit_properties(o)
o.each do |k, v|
next if k == 'CustomerKey'
formatted.concat FuelSDK.format_name_value_pairs k => v
formatted.concat MarketingCloudSDK.format_name_value_pairs k => v
o.delete k
end
o['Properties'] = {'Property' => formatted }
Expand All @@ -546,7 +546,7 @@ def munge_properties d
else
formatted = []
d.each do |k, v|
formatted.concat FuelSDK.format_name_value_pairs k => v
formatted.concat MarketingCloudSDK.format_name_value_pairs k => v
d.delete k
end
d['CustomerKey'] = customer_key
Expand Down
4 changes: 2 additions & 2 deletions lib/fuelsdk/rest.rb → lib/marketingcloudsdk/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=end

module FuelSDK
module MarketingCloudSDK
module Rest

include FuelSDK::Targeting
include MarketingCloudSDK::Targeting

def rest_client
self
Expand Down
8 changes: 4 additions & 4 deletions lib/fuelsdk/soap.rb → lib/marketingcloudsdk/soap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
=end

require 'savon'
module FuelSDK
module MarketingCloudSDK

class SoapResponse < FuelSDK::Response
class SoapResponse < MarketingCloudSDK::Response

def continue
rsp = nil
Expand Down Expand Up @@ -116,7 +116,7 @@ def unpack_rslts raw
module Soap
attr_accessor :wsdl, :debug#, :internal_token

include FuelSDK::Targeting
include MarketingCloudSDK::Targeting

def header
raise 'Require legacy token for soap header' unless internal_token
Expand Down Expand Up @@ -249,7 +249,7 @@ def soap_cud action, object_type, properties, upsert=nil
# p.each do |k, v|
# if type_attrs.include? k
# p.delete k
# attrs = FuelSDK.format_name_value_pairs k => v
# attrs = MarketingCloudSDK.format_name_value_pairs k => v
# formated_attrs.concat attrs
# end
# end
Expand Down
Loading

0 comments on commit 428253d

Please sign in to comment.