Skip to content

luckie/fuelsdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fuelsdk Gem Version Code Climate Build Status Coverage Status

ExactTarget Fuel SDK 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.

Requirements

Ruby Version 1.9.3

Getting Started

Add this line to your application's Gemfile:

gem 'fuelsdk'

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.

Backwards Compatibility

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 FuelSDK::Subscriber or ET_Subscriber.

Example Request

Add a require statement to reference the Fuel SDK's functionality:

require 'fuelsdk'

Next, create an instance of the Client class:

myClient = FuelSDK::Client.new {'client' => { 'id' => CLIENTID, 'secret' => SECRET }}

Create an instance of the object type we want to work with:

list = FuelSDK::List.new

Associate the Client to the object using the client property:

list.client = myClient

Utilize one of the List methods:

response = list.get

Print out the results for viewing

p response

Example Output:

 {:overall_status=>"OK", :request_id=>"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", :results=>..}
 @code= 200,
 @message= 'OK',
 @request_id="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
 @results=
  [{:client=>{:id=>"xxxx"},
    :partner_key=>nil,
    :created_date=>
     #,
    :id=>"xxxx",
    :object_id=>nil,
    :email_address=>"xxxx",
    :attributes=>
     [{:name=>"Full Name", :value=>"Justin Barber"},
      {:name=>"Gender", :value=>nil},
      {:name=>"Email Address", :value=>"xxx"},
      {:name=>"User Defined", :value=>"02/02/1982"}],
    :subscriber_key=>"xxxx",
    :status=>"Active",
    :email_type_preference=>"HTML",
    :"@xsi:type"=>"Subscriber"},
 @success=true>

Client Class

The Client class takes care of many of the required steps when accessing ExactTarget's API, including retrieving appropriate access tokens, handling token state for managing refresh, and determining the appropriate endpoints for API requests. In order to leverage the advantages this class provides, use a single instance of this class for an entire session. Do not instantiate a new Client object for each request made.

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.

  • success?: Boolean value that indicates if the call was successful
  • code: HTTP Error Code (will always be 200 for SOAP requests)
  • message: Text values containing more details in the event of an error
  • results: Collection containing the details unique to the method called.
  • more? - Boolean value that indicates on Get requests if more data is available.

Samples

Find more sample files that illustrate using all of the available functions for ExactTarget objects exposed through the API in the samples directory.

Sample List:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published