Giter Site home page Giter Site logo

fuelsdk-ruby's Introduction

FuelSDK-Ruby / MarketingCloudSDK-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.

New Features in Version 1.3.1

  • Updated below packages to latest version
    • savon: ">= 2.12.1"
    • json: ">= 2.2.0"
    • jwt: ">= 2.1.0"

New Features in Version 1.3.0

  • Added Refresh Token support for OAuth2 authentication

  • Added Web/Public App support for OAuth2 authentication

    More details on Access Tokens for Web/Public Apps can be found here

    Example of instantiating the Client class:

    myclient = MarketingCloudSDK::Client.new({
        'client' => {
            'id' => '<CLIENT_ID>',
            'secret' => '<CLIENT_SECRET>',
            'request_token_url' => '<AUTH TENANT SPECIFIC ENDPOINT>',
            'soap_endpoint' => '<SOAP TENANT SPECIFIC ENDPOINT>',
            'base_api_url' => '<REST TENANT SPECIFIC ENDPOINT>',
            'use_oAuth2_authentication' => true,
            'account_id' => <TARGET_ACCOUNT_ID>,
            'scope' => '<PERMISSION_LIST>',
            'application_type' => '<APPLICATION_TYPE>',
            'redirect_URI' => '<REDIRECT_URI_FOR_PUBLIC/WEB_APP>',
            'authorization_code' => '<AUTHORIZATION_CODE_FOR_PUBLIC/WEB_APP>'
            }
        })
    
  • application_type can have one of the following values: server, public, web. The default value of application_type is server.

New Features in Version 1.2.0

  • OAuth2 authentication support - More Details

    To enable OAuth2 authentication, pass use_oAuth2_authentication => true in the params argument to the Client's class constructor.

    Example of instantiating the Client class:

    myclient = MarketingCloudSDK::Client.new({
        'client' => {
            'id' => '<CLIENT_ID>',
            'secret' => '<CLIENT_SECRET>',
            'request_token_url' => '<AUTH TENANT SPECIFIC ENDPOINT>',
            'soap_endpoint' => '<SOAP TENANT SPECIFIC ENDPOINT>',
            'base_api_url' => '<REST TENANT SPECIFIC ENDPOINT>',
            'use_oAuth2_authentication' => true,
            'account_id' => <TARGET_ACCOUNT_ID>,
            'scope' => '<PERMISSION_LIST>'
            }
        })
    

New Features in Version 1.1.0

  • **Added support for your tenant's endpoints - More Details **
  • **MarketingCloudSDK gem will be available as sfmc-fuelsdk-ruby on ruby gems.

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 .
  • Profile Attribute Support: Added the ability to manage profile attributes through the ProfileAttribute object.
  • Support for single request to Add/Update:A single request can be made which will create the object if one doesn't already or update one if it does. This works for Subscriber, DataExtension::Row, and List objects using the Put method.
  • Tracking Events Batching Support: By default, all tracking event types will only pull new data since the last time a request was made using the same filter. If you would like to override this functionality to pull all data, simply set the GetSinceLastBatch property to false.
  • Automatic Asset Organization for Hub Apps: Applications that authenticate by providing a JWT will automatically have all created assets placed into a folder based on the HubExchange app's name.
  • 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

  • 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 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 2.2.5
  • Savon 2.2.0

Getting Started

Build the gem from the source

gem build marketingcloudsdk.gemspec

Install the newly built gem

gem install marketingcloudsdk-1.3.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.

Example Request

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

require 'marketingcloudsdk'

Next, create an instance of the Client class:

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

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

list = MarketingCloudSDK::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.

Client class accepts multiple parameters

Parameters - Allows for passing authentication information for use with SSO with a JWT or for passing ClientID/ClientSecret. Additionally the API hostname (base_api_url),Authentication URL (request_token_url) and the SOAP endpoint (soap_endpoint) is now configurable:

Example passing ClientID/ClientSecret:

myclient = MarketingCloudSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret'}})

Example passing ClientID/ClientSecret/AppSignature/JWT:

myclient = MarketingCloudSDK::Client.new({'client' => {'id' => 'exampleID','secret' => 'exampleSecret', 'signature'=>'examplesig'}, 'jwt'=>'exampleJWT'})

Example passing ClientID/ClientSecret/BaseAPIUrl/ReqTokenAuthUrl/Soap Endpoint

myclient = MarketingCloudSDK::Client.new('client' => {'id' => 'exampleID', 'secret' => 'exampleSecret', 'base_api_url' => 'http://getapis', 'request_token_url' => 'http://authapi', 'soap_endpoint' => 'http://soapendpoint'})

Note - The following defaults apply if the following parameters are omitted:

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 = MarketingCloudSDK::Client.new auth, true

Responses

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)
  • 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.

fuelsdk-ruby's People

Contributors

amagar088 avatar barberj avatar clupprich avatar ipetresf avatar jshorty avatar kellyjandrews avatar michaelallenclark avatar rhrituc avatar rsliter avatar satish-singhal avatar sfdrogojan avatar svc-scm avatar thembadev avatar tkauble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuelsdk-ruby's Issues

RubyGems

We're developing a gem that uses FuelSDK. We can't specify this repo in the gemspec, since the https://github.com/barberj/fuelsdk fork is what's on RubyGems. Can you put your gem on RubyGems?

I think Justin Barber created his fork due to lack of activity on this repo. Would you be willing to merge his fork back into the official repo?

'Login Failed' trying to post to API

I'm making the following request from the docs:

myClient = FuelSDK::Client.new({'client' => { 'id' => CLIENTID, 'secret' => SECRET }})
list = FuelSDK::List.new
list.authStub = myClient
list.props = {"ListName" => "SDKList", "Description" => "SDK Created List"}
results = list.post

The response includes this body:

@body={:fault=>{:faultcode=>"q0:Security", :faultstring=>"Login failed", :faultactor=>"https://webservice.s7.exacttarget.com/Service.asmx"}}

What does this mean? Am I missing some configuration?

Savon 2.3.0 causes "Requested value 'APIObject' was not found." error

Having switched to the Dot9Refactor branch, I'm still getting the error:

"Requested value 'APIObject' was not found."

This is the same error I got when trying to send a post request to a data extension using the master branch, and it is caused by the same test re-implemented using your Dot9Refactor branch.

Can you please do a proper test of the DataExtension post method against an actual live Exact Target account? Since the post test is the only one of my suite that's failing (all the rest are get) I'm still inclined to think that this is a bug with the FuelSDK-Ruby library. But I'd be happy to find out otherwise, that'd be easier to fix!

Success? Returns false when message is 'MoreDataAvailable'

This seems like a bug, but perhaps I'm thinking about it incorrectly. success is determined by the message returned with a request.

def unpack raw
  ...
  @success = @message == 'OK'
end

However, if the number of results exceeds the page size, the message returned is not OK it's MoreDataAvailable. The request itself was successful, so it seems wrong to say that success = false.

FuelSDk is showing Error message while sending a POST request

Hi Team,

I have created one Email Data Extension object in Marketing Cloud which have below fields-

Object Name: books

bookid text . (Primary Key)
name text
description text

I am trying to post data from Ruby code with FuelSDK Gem but getting below error message evry time while post

Error Message : TypeError (no implicit conversion of String into Integer)

Please find the below line of code for the same-

dataextension = FuelSDK::DataExtension::Row.new

dataextension.authStub = myClient
dataextension.Name = 'books'
dataextension.CustomerKey='booksdetail'
dataextension.props = {'boodid' => 'S1234', 'name' => 'MyBookDetails', 'description' => 'Hello'}

results = dataextension.post

I am getting this error on dataextension.post. Please let me know what I doing mistake here.

Subscriber activated on incorrect list

When patching an existing Subscriber to change their status from 'Unsubscribed' to 'Active' on a specific list, the wrong list gets activated.

So e.g. if Subscriber is 'Unsubscribed' on both List1 and List2, and you patch the Subscriber to activate them on list2. List1 gets activated and List2 remains 'Unsubscribed'

sub = FuelSDK::Subscriber
sub.authStub = authStub
sub.props = {'Status' => 'Active', 'SubscriberKey' => email_address, 'ID' => subscriber_id, 'ListID' => list_id}
sub.patch

Patch succeeds but a query of the FuelSDK::List::Subscriber for that email address shows that the wrong list_id was updated.

Data Extension - Remove Row

I'm using the fuelsdk gem and when I try to remove a data extension row I'm having a problem.

This is my code:

client = ET_Client.new auth

de_row = ET_DataExtension::Row.new()
de_row.authStub = client
de_row.CustomerKey = "XXXXXXXXXXXX"
de_row.props = {"Web_FIC" => fic}
response = de_row.delete

This is my error

TypeError: can't convert String into Integer
from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/fuelsdk-0.1.7/lib/fuelsdk/objects.rb:220:in []=' from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/fuelsdk-0.1.7/lib/fuelsdk/objects.rb:220:inblock in add_customer_key'
from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/fuelsdk-0.1.7/lib/fuelsdk/objects.rb:218:in each' from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/fuelsdk-0.1.7/lib/fuelsdk/objects.rb:218:inadd_customer_key'
from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/fuelsdk-0.1.7/lib/fuelsdk/objects.rb:212:in delete' from (irb):37 from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.17/lib/rails/commands/console.rb:47:instart'
from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in start' from /Users/raphaelpetegrosso/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.17/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

So I opened your gem and checked that the error was in this line:

d['CustomerKey'] = customer_key

but in my case d is an array and not a hash. Then I changed the code to this:
d << 'CustomerKey'
d << customer_key

And it worked, but my response came with this error:

status_message=>"Exception occurred during [Delete] ErrorID: 1913074240"

It seems that the gem version is not updated, right? Any idea what is the error?

Thanks

Additional maintainer?

My company is switching to MarketingCloud and we are heavily depending on this SDK. I'd like to help maintain this gem, set up automated tests, and clean up the issue and PR queues. I am presently one of the maintainers of Capistrano, and have a number of years of experience maintaining Ruby applications.

Would any of the maintainers be willing to bring me on board with this?

Thanks!
~William Johnston
Software Engineer
Minnesota Public Radio/American Public Media

cc: @barberj (it looks like you've been doing work most recently, thanks!)

[Required Update]

Is your feature request related to a problem? Please describe
As of September 30, 2022, SFMC will require "tenant-specific endpoints" instead of the ones currently used by this gem. The following page explains the changes:

https://help.salesforce.com/s/articleView?id=000357115&type=1

Describe the solution you'd like
In my opinion, the Client method will need to be modified to either accept a tenant-specific endpoint parameter during initialization, or obtain this via the API if that's possible.

Delete records from Marketing cloud through Rest API

Hi Team,

I have created a DataExtension in MarketingCloud i.e SurveyDetails which has below fields-

SurveyID
SurveyDescription
CreatedAt

I want to delete Some SurveyID from this Data Extension. let's say want to delete SurveyID='S0001'. Could you please help me how I can delete this records through marketing Cloud APi. I went through below portal but didn't help much as it's referring only contact object.

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/getDeleteOptions.htm

Regards,
Puneet Gaur

Error while decoding the JWT token with signature

There is an issue on decoding the JWT token with signature while initializing the MarketingCloudSDK::Client where the decode method returns an array [payload, header] but the code in the gem is accessing as hash which raises the error TypeError (no implicit conversion of String into Integer): after line number 87.

The JWT gem version in jwt 1.5.4

I have fixed the issue and created a pull request #63 with the fix.

Update JSON library to version 2 to 3

Is your feature request related to a problem? Please describe
The JSON library is too old. Need to use a new version with new gems.

Describe the solution you'd like
Update json library max requisites.

QueryDefinition soap_delete error

I'm calling soap_delete as follows:

fuelsdk_client.soap_delete("QueryDefinition", {"ObjectID" => my_object_id})

and receiving this error:

An entry with the customer key already exists

Here's the full error results hash:

{:status_code=>"Error", :status_message=>"An entry with the customer key already exists", :ordinal_id=>"0", :error_code=>"9999999", :object=>{:partner_key=>nil, :object_id=>"e6358dd9-b21e-4ee8-af1b-0d9217db755f", :customer_key=>"34847-test-query-restore", :"@xsi:type"=>"QueryDefinition"}}

Trouble connecting to the client after the April 1st Permission update

On the Account Information, for API Integration, there are 6 different pieces of information on the page:

  • Client ID
  • Client Secret
  • Integration Type
  • Authentication Base URI
  • REST Base URI
  • SOAP Base URI

From the readme this is what is available:

myclient = MarketingCloudSDK::Client.new(
  'client' => {
    'id' => 'exampleID',
    'secret' => 'exampleSecret',
    'base_api_url' => 'http://getapis',
    'request_token_url' => 'http://authapi',
    'soap_endpoint' => 'http://soapendpoint'})

I've tried mapping several variations, but it's not working for me. Is there a better example of the code above that would indicate what's best to use here?

Triggered Send Failing.

Triggered Sends are failing when I use the gem.

I have checked against another gem 'exact_target' and the credentials are valid as the calls go through but I actually get a describe error when trying to perform the same action using this gem.

[ Sensitive information such a keys and email addresses have been filtered out ]

auth = FuelSDK::Client.new({'client'=>{'id'=>'#{ENV['client_id']}','secret'=>'#{ENV['client_secret']}'}})
=> #<FuelSDK::Client:0x007fb58bbff4d0 @debug=false, @id="#{ENV['client_id']}", @secret="#{ENV['client_secret']}", @Signature=nil>
1.9.3p484 :035 > auth.debug = true
=> true
1.9.3p484 :036 > ts = FuelSDK::TriggeredSend.new
=> #FuelSDK::TriggeredSend:0x007fb58bc42708
1.9.3p484 :037 > ts.authStub = auth
=> #<FuelSDK::Client:0x007fb58bbff4d0 @debug=true, @id="#{ENV['client_id']}", @secret="#{ENV['client_secret']}", @Signature=nil>
1.9.3p484 :038 > ts.props = { "CustomerKey" => "Test" }
=> {"CustomerKey"=>"Test"}
1.9.3p484 :039 > ts.subscribers = [{"EmailAddress"=>"[email protected]","SubscriberKey"=>"[email protected]"}]
=> [{"EmailAddress"=>"[email protected]", "SubscriberKey"=>"[email protected]"}]
1.9.3p484 :040 > rs = ts.send

FuelSDK::DescribeError: Unable to get TriggeredSend
from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:163:in get_all_object_properties' from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:213:inget_editable_properties'
from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:356:in format_object_cud_properties' from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:377:innormalize_properties_for_cud'
from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:385:in soap_cud' from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/soap.rb:290:insoap_post'
from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/fuelsdk-0.1.6/lib/fuelsdk/objects.rb:139:in send' from (irb):40 from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/railties-3.2.16/lib/rails/commands/console.rb:47:instart'
from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/railties-3.2.16/lib/rails/commands/console.rb:8:in start' from ~/.rvm/gems/ruby-1.9.3-p484@journey-merchant-portal/gems/railties-3.2.16/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

Please deprecate this repository

Please deprecate this repository, or give a full revamp.

Being a developer it's not pleasant at all to work with this code. Many common practices have not been followed. I've spent so much time already trying to debug this.

Open SSL Connection reset by peer

Hi,

I am trying to add a row in a data extension I have created following the sample-dataextension.rb Add a row to a data extension (using CustomerKey). I keep on having the same error:
ECONNRESET: Connection reset by peer - SSL_connect

Here is the code I run from a rails console:

CLIENT_ID = "%OUR_CLIENT_ID%"
SECRET = "%OUR_SECRET%"
DE_CUSTOMER_KEY = "%OUR_DE_CUSTOMER_KEY%"
de_row_proerties = {"de_attribute" => "value"}

auth = {
  "client" => {
    "id" => CLIENT_ID,
    "secret" => SECRET
  },
  "defaultwsdl" => "https://webservice.s7.exacttarget.com/etframework.wsdl"
}

stubObj = ET_Client.new auth, true
de = ET_DataExtension::Row.new
de.CustomerKey = DE_CUSTOMER_KEY
de.authStub = stubObj
de.props = de_row_proerties
de.post

Here is the error I get (with the debug mode enabled) :

D, [2017-05-18T17:13:24.193758 #9943] DEBUG -- : HTTPI GET request to webservice.s7.exacttarget.com (httpclient)
D, [2017-05-18T17:13:24.487087 #9943] DEBUG -- : HTTPI GET request to webservice.s7.exacttarget.com (httpclient)
Errno::ECONNRESET: Connection reset by peer - SSL_connect
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:303:in `connect'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:303:in `ssl_connect'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:760:in `block in connect'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/2.2.0/timeout.rb:88:in `block in timeout'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/2.2.0/timeout.rb:98:in `call'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/2.2.0/timeout.rb:98:in `timeout'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/2.2.0/timeout.rb:124:in `timeout'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:751:in `connect'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:609:in `query'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:164:in `query'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:1083:in `do_get_block'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:887:in `block in do_request'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:981:in `protect_keep_alive_disconnected'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:886:in `do_request'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpclient-2.3.4.1/lib/httpclient.rb:774:in `request'
	from /Users/bensotty/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/httpi-2.0.2/lib/httpi/adapter/httpclient.rb:26:in `request'

I am running a project on rails 4.2.7.1, on my local machine, mac os 10.12.3, using OpenSSL 1.0.2k.

Any ideas ? Is this a bug on the sdk ?

Thanks for helping.

Status of this SDK

We are trying to bring up our MarketingCloud integration, and trying to decide whether to use this SDK, which seems to be abandoned. @amagar088, you did the last string of commits (ending in 2016) โ€” are you still around? What is the roadmap? Thanks.

Missing tag 0.0.6

Can you please add tag 0.0.6 referencing following commit 72f97ab?

After transition to new repo our existing Gemfile reference stopped working.

Thanks in ahead.

Certificate Verify Failed

Whenever I try to run any of the samples, I receive the following error:

"Caught exception: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"

Thoughts? @MichaelAllenClark

Getting Error Code 12018

While creating a subscriber I am getting error code 12018 from ET. Can you please let me know what does it mean?

Or How can I get a sample SOAP envelope that this gem creates while sending request?

Rebuild or Refactor

Would love to get everyones opinion - should we start from the beginning, or refactor what we have? Seems like a lot of issue keep popping up, and this is compatible with Ruby 1.9.3 - might be nice to support the latest Ruby version.

Any suggestions?

MarketingCloudSDK::Response.continue fails

If an API request results in greater than 2500 results, the docs instruct users to call response.continue to fetch the rest of the results, but doing so fails and instead results in an array being returned.

Created a pull request here: #84

*EDIT
Found an earlier PR here
#39

But as a temporary workaround, you can do the following:

response = @dataextensionrow.get
while response.more?
  response.send(:unpack, @client.soap_client.call(:retrieve, message: { 'RetrieveRequest' => {'ContinueRequest' => response.request_id}}))
end

How to create a subscriber with properties/profile attributes?

I'm trying to do the simple task of creating a subscriber with attributes and adding him/her to a list.

This code works:

client = FuelSDK::Client.new({'client' => { 'id' => CLIENTID, 'secret' => SECRET }}, true)
subscriber = FuelSDK::Subscriber.new
subscriber.client = client
subscriber.properties = {
  "EmailAddress" => '[email protected]',
  "Lists" =>[{"ID" => LISTID}]
}
subscriber.post

But if I add a another custom property to subscriber.properties, I get a FuelSDK::SoapResponse with body Bad Request. Neither of these work:

subscriber.properties = {
  "EmailAddress" => '[email protected]',
  "Full Name" => "John Doe", # Space separated key
  "Lists" =>[{"ID" => LISTID}]
}
subscriber.properties = {
  "EmailAddress" => '[email protected]',
  "FullName" => "John Doe", # Camelcase key
  "Lists" =>[{"ID" => LISTID}]
}

There is a sample file for profile attributes but it only shows how to create, update, and delete profile attributes. It doesn't say how to apply them to a subscriber.

Also, I should add that I made the following change to the gemspec to get it to work with our Rails 4 app:

spec.add_dependency "savon", '2.2.0'
spec.add_dependency "json" # used to be "~> 1.7.0"
spec.add_dependency "jwt" # used to be "~> 0.1.6"

Please delete dead code

It looks like the class starting on line 163 of lib/new.rb (ET_Client) is dead code and is overridden by lib/marketingcloudsdk.rb line 54. Would you please delete this and any other code that might be useless at this point? We just spent a couple of hours trying to debug code that isn't used anywhere.

Thanks!

support for activerecord 4

Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
fuelsdk (>= 0) ruby depends on
activesupport (~> 3.2.8) ruby

Savon 2.3.0 causes "Requested value 'APIObject' was not found." error

I've been able to get the ET_DataExtension get methods to work just fine, but using post fails with the following message:

"Requested value 'APIObject' was not found."

This happens both in my own code and in the supplied objsamples/sample-dataextension.rb test script.

I looked at the post method and found a large commented block of text with the comment "# FIX THIS" but this commented section seemed to be related to passing an array of values instead of a hash, and I've been using hashes with values mapped directly to the data extension's column names as returned by the Column get method.

Since the objsamples/sample-dataextension.rb script also fails on all post requests (and actually encounters a fatal error and crashes within the first half of the script) I'm guessing this error is related to a bug in the FuelSDK-Ruby library. Can you please advise on how I should proceed, or if you are able to fix this?

Getting 'Require Client Id and Client Secret to refresh tokens' while running sample code

Am I missing something? Created an App for s1.q1 in Appcenter and tried sample executing code in irb

Code

require 'fuelsdk'

myClient = FuelSDK::Client.new auth_hash
dataextensionrow = FuelSDK::DataExtension::Row.new
dataextensionrow.authStub = myClient
dataextensionrow.Name = 'ExampleDEName'
dataextensionrow.props = ['FirstName', 'LastName', 'AnotherColumnName']
response = dataextensionrow.get

Error:

RuntimeError: Require Client Id and Client Secret to refresh tokens
from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/client.rb:114:in block in refresh' from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/client.rb:113:insynchronize'
from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/client.rb:113:in refresh' from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/soap.rb:138:insoap_client'
from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/soap.rb:276:in soap_request' from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/soap.rb:219:insoap_get'
from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/objects.rb:43:in get' from /Users/adeshpande/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fuelsdk-0.0.5/lib/fuelsdk/objects.rb:457:inget'

[BUG] - 400 response when inserting or updating Data Extension rows

Describe the bug
A few months ago, we started receiving 400s when doing a post on ::MarketingCloudSDK::DataExtension::Row. The only message we get with the response is Bad Request. I did notice that this gem has not been updated in a while, does it just need to be updated?

To Reproduce

def auth_client
   ::MarketingCloudSDK::Client.new(
      "client" => {
        "id" => @salesforce_profile.client_id,
        "secret" => @salesforce_profile.client_secret
     },
     "request_token_url" => "#{@salesforce_profile.tenant_endpoint}.auth.marketingcloudapis.com/v1/requestToken",
     "defaultwsdl" => "#{@salesforce_profile.tenant_endpoint}.soap.marketingcloudapis.com/etframework.wsdl"
   )
 end

row_client = ::MarketingCloudSDK::DataExtension::Row.new
row_client.authStub = auth_client
row_client.filter = nil
      row_client.props =
        {
          # We are hard coding in the column names here based off of the hard coded data extension above.
          # This code will need to be fixed to use the column_names method above and then update based off of those
          "CampaignExpirationDate" => offer.campaign.end_time,
          "CampaignName" => offer.campaign.name,
          "CampaignGuid" => offer.campaign.guid,
          "LastDismissDate" => offer.dismissed_at,
          "LastImpressionDate" => offer.viewed_at,
          "FirstImpressedAt" => offer.first_viewed_at,
          "FistClickedAt" => offer.first_clicked_at,
          "LastClickDate" => offer.clicked_at,
          "BannerActivationDate" => offer.created_at,
          "SubscriberKey" => subscriber_key,
          "FirstViewedAt" => offer.first_viewed_at,
          "LastViewDate" => offer.viewed_at,
          "MobileBannerName" => mobile_banner_name,
          "JourneyName" => journey_name,
          "ViewCount" => offer.impression_count.to_s,
          "ImpressionCount" => offer.impression_count.to_s,
          "CampaignPriority" => offer.campaign.priority.to_s,
        }
      @row_response = row_client.post

Expected behavior
A successful response

Environment

  • SDK Version: 1.3.1
  • Ruby version: jruby-9.3.8.0

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Certificate issue on Heroku?

I have a simple Sinatra/Sidekiq app hosted on Heroku that uses FuelSDK::TriggeredSend, and it has been running without issue for several months. On March 2nd, it began giving me an error related to SSL_connect (certificate error):

2016-03-16T23:54:34.096396+00:00 app[worker.1]: 2016-03-16T23:54:34.096Z 3 TID-ow8ih16fo WARN: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
2016-03-16T23:54:34.096459+00:00 app[worker.1]: 2016-03-16T23:54:34.096Z 3 TID-ow8ih16fo WARN: /app/vendor/bundle/ruby/2.3.0/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:36:in `rescue in request'
2016-03-16T23:54:34.096461+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:27:in `request'
2016-03-16T23:54:34.096462+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/httpi-2.0.2/lib/httpi.rb:137:in `request'
2016-03-16T23:54:34.096463+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/httpi-2.0.2/lib/httpi.rb:109:in `post'
2016-03-16T23:54:34.096463+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/savon-2.2.0/lib/savon/operation.rb:67:in `call!'
2016-03-16T23:54:34.096464+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/savon-2.2.0/lib/savon/operation.rb:49:in `call'
2016-03-16T23:54:34.096465+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/savon-2.2.0/lib/savon/client.rb:36:in `call'
2016-03-16T23:54:34.096466+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/bundler/gems/FuelSDK-Ruby-7994480f7854/lib/fuelsdk/soap.rb:276:in `soap_request'
2016-03-16T23:54:34.096466+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/bundler/gems/FuelSDK-Ruby-7994480f7854/lib/fuelsdk/soap.rb:269:in `soap_cud'
2016-03-16T23:54:34.096467+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/bundler/gems/FuelSDK-Ruby-7994480f7854/lib/fuelsdk/soap.rb:223:in `soap_post'
2016-03-16T23:54:34.096468+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/bundler/gems/FuelSDK-Ruby-7994480f7854/lib/fuelsdk/objects.rb:398:in `send'
2016-03-16T23:54:34.096469+00:00 app[worker.1]: /app/exact_target_client.rb:37:in `triggered_send'
2016-03-16T23:54:34.096469+00:00 app[worker.1]: /app/submission_service.rb:24:in `perform'
2016-03-16T23:54:34.096470+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/processor.rb:75:in `execute_job'
2016-03-16T23:54:34.096471+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
2016-03-16T23:54:34.096471+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
2016-03-16T23:54:34.096472+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
2016-03-16T23:54:34.096473+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2016-03-16T23:54:34.096473+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/server/logging.rb:15:in `block in call'
2016-03-16T23:54:34.096474+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/logging.rb:24:in `with_context'
2016-03-16T23:54:34.096475+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/server/logging.rb:11:in `call'
2016-03-16T23:54:34.096476+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
2016-03-16T23:54:34.096476+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/middleware/chain.rb:132:in `invoke'
2016-03-16T23:54:34.096477+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/processor.rb:51:in `block in process'
2016-03-16T23:54:34.096477+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/processor.rb:98:in `stats'
2016-03-16T23:54:34.096478+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/sidekiq-3.3.4/lib/sidekiq/processor.rb:50:in `process'
2016-03-16T23:54:34.096479+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
2016-03-16T23:54:34.096479+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
2016-03-16T23:54:34.096480+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
2016-03-16T23:54:34.096481+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
2016-03-16T23:54:34.096481+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
2016-03-16T23:54:34.096482+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
2016-03-16T23:54:34.096483+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
2016-03-16T23:54:34.096484+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.3.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'

I'm familiar with the reasons for the SSL_connect issue, but for the life of me, I can't seem to address this without setting Net::HTTP's verify_mode to OpenSSL::SSL::VERIFY_NONE.

I suspect that something has changed on the Heroku side of things, but am curious to hear if you have any suggestions.

Are Programs supported?

I've got some code using this gem which starts an Import. I would like to change it to start a Program instead, but it looks like there's no support for running a Program in the gem. Are Programs supported, or is that in the works?

(Looking at the other classes, like Import - https://github.com/ExactTarget/FuelSDK-Ruby/blob/master/lib/fuelsdk/objects.rb#L216 - it seems as though adding support for Programs might be fairly simple, but I don't know whether the underlying SOAP API has the functionality that would be needed.)

Sidekiq : Throwing Error Message

I am using Sidekiq for the background process and creat a very simple application to validate Sidekiq functionality. I am getting success response but getting failure message when calling it through sidekiq. Please help me resolve this issue.

Error Message :
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: {"context":"Job raised exception","job":{"class":"ProcessWorker","args":["{"name"=>"Hello", "description"=>"Hello666", "author"=>"Hello"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172},"jobstr":"{"class":"ProcessWorker","args":["{\"name\"=>\"Sumit8901\", \"description\"=>\"Hello666\", \"author\"=>\"Hello7777\"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172}"}
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: ArgumentError: When assigning attributes, you must pass a hash as an argument.
2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN:

Please find the below code-

Controller class:
books_controller.rb
def create
@job=ProcessWorker.perform_async(book_params)
h = {"response" => {"job_id" => @job}}
render json: h
end

Worker Class:

class ProcessWorker
include Sidekiq::Worker
def perform(book_params)
book = Book.new(book_params)
book.save
end
end

Migrations Class:
class CreateBooks < ActiveRecord::Migration[5.1]
def change
create_table :books do |t|
t.string :name
t.string :description
t.string :author

  t.timestamps
end

end

Connection reset by peer - SSL_connect

Hi,

Since today, I am getting SSL error when trying to access Marketing cloud APIs using FuelSDK-Ruby. It keep on throwing the two errors

SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A and Connection reset by peer - SSL_connect.

I am using OpenSSL version: 1.0.2l (macOS Sierra version: 10.12)

Below is the trace of the error:

SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A

/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:36:in `rescue in request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:27:in `request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi.rb:137:in `request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi.rb:103:in `get'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/resolver.rb:42:in `load_from_remote'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/resolver.rb:32:in `resolve'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:120:in `xml'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:138:in `parse'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:125:in `parser'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:61:in `soap_actions'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/operation.rb:21:in `ensure_exists!'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/operation.rb:14:in `create'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/client.rb:32:in `operation'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/client.rb:36:in `call'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/soap.rb:275:in `soap_request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/soap.rb:219:in `soap_get'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/objects.rb:43:in `get'
Connection reset by peer - SSL_connect
/Users/jayaprakash/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock'
/Users/jayaprakash/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:933:in `connect'
/Users/jayaprakash/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/Users/jayaprakash/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/http.rb:852:in `start'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:54:in `do_request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi/adapter/net_http.rb:31:in `request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi.rb:137:in `request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/httpi-2.0.2/lib/httpi.rb:103:in `get'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/resolver.rb:42:in `load_from_remote'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/resolver.rb:32:in `resolve'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:120:in `xml'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:138:in `parse'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:125:in `parser'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/wasabi-3.1.0/lib/wasabi/document.rb:61:in `soap_actions'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/operation.rb:21:in `ensure_exists!'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/operation.rb:14:in `create'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/client.rb:32:in `operation'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/gems/savon-2.2.0/lib/savon/client.rb:36:in `call'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/soap.rb:275:in `soap_request'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/soap.rb:219:in `soap_get'
/Users/jayaprakash/.rvm/gems/ruby-2.3.1@mcapp/bundler/gems/FuelSDK-Ruby-384a48ab965a/lib/marketingcloudsdk/objects.rb:43:in `get'

Can anyone help me please.

Thank you.

Refactor progress, and bug reporting?

We are diving into a substantial project with ET and Ruby. We've currently written our own wrapping layers around the Dot9Refactor branch. Kudos to Barberj for getting started on the work of making this interface a little more Rubyish.

If we find bugs, is the best place to report them here? Report them to premium ET support? Given how far the Ruby driver has to come, we're happy to contribute back what we discover in our travels, but want to make sure we're helping, not creating noise.

In particular, we'd love to work off of this repo, instead of branching our own...

[BUG] Gem doesn't work on servers which don't have git installed

Describe the bug
This gem does not work when git is not installed - this can be a problem in production servers, even if git based deployment is used. It is because it does this in the gemspec:

 spec.files         = `git ls-files`.split($/)

I fixed it like this:

      spec.files         = `du -a`.split("\n").map{|line| line.split("\t")[1].sub('./','')} - ["spec", "samples", ".github/ISSUE_TEMPLATE", ".github", "lib/marketingcloudsdk", "lib", "."]

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (e.g. gif) is not sufficient.

Environment

  • SDK Version [e.g. 1.2.0]
  • Ruby version

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Additional context
Add any other context about the problem here.

MarketingCloudSDK::TriggeredSend doesn't support client ID

In an enterprise installation, you have to provide a client ID as part of the SOAP response. I subclassed it to fix the issue in my system:

class OurWorkingTriggeredSend < MarketingCloudSDK::TriggeredSend
  def send(client_id)
    if properties.is_a? Array
      tscall = []
      properties.each do |p|
        tscall.push(
          'TriggeredSendDefinition' => {
            'CustomerKey' => p['CustomerKey']
          },
          'Subscribers' => p['Subscribers'],
          'Attributes' => p['Attributes'],
          'Client' => { 'ID' => client_id }
        )
      end
    else
      tscall = { 'TriggeredSendDefinition' => properties, 'Subscribers' => @subscribers, 'Attributes' => @attributes, 'Client' => { 'ID' => client_id } }
    end
    client.soap_post 'TriggeredSend', tscall
  end
end

But I'm not sure how this would prefer to be fixed upstream. If you would give me any hints as to a preferred mechanism, I'll send a pull request.

Thanks!

Rubocop

Would you be open to running the codebase through rubocop and adding that to some kind of CI? This would make it easier for people to contribute by bringing the code basically in line with standard Ruby styles. The particular thing I'd like to see changes is going to 2 spaces for indentation instead of tabs.

Thanks!

are Query Activities supported?

I could just be missing them, but I don't see a FuelSDK::Query or equivalent. Is it possible to dynamically generate and run query activities?

Or is there another way of running SQL queries against a data extension via the API? My understanding is that the simple filter functionality in FuelSDK::DataExtension won't be able to return COUNT(), and since I'm trying to pull tracking data the number of raw rows will be in the millions (and thus be severely truncated by the API's 2500 row return limit).

My thought was to dynamically generate a temporary data extension and a temporary query which would populate the data extension with the count data I'm looking for. Then the data extension contents would be pulled down via API and the temporary data extension and query deleted.

Getting SQL error from Marketing Cloud server 310006

When trying to create a Data extension using the API, I encounter this error :

{:status_code=>"Error",
    :status_message=>
     "Error occurred while saving Custom Object DE example (xxxxxxx-xxxxxx-xxxx): Incorrect syntax 
near ','.\nIncorrect syntax near the keyword 'with'. If this statement 
is a common table expression, an xmlnamespaces clause or a change tracking context clause, the 
previous statement must be terminated with a semicolon.\nIncorrect syntax near the keyword 'with'. 
If this statement is a common table expression, an xmlnamespaces clause or a change tracking 
context clause, the previous statement must be terminated with a semicolon.",

It is a SQL error on their server. Anyone else got this ?

FuelSDK::Objects::Base#properties isn't a hash

The getter defined for FuelSDK::Objects::Base#properties returns an Array which causes code like:

# lib/fuelsdk/client.rb: 107
s = FuelSDK::Subscriber.new
s.properties = {"EmailAddress" => email, "Lists" => lists}
#[...]
s.properties['SubscriberKey'] = subscriber_key if subscriber_key

to fail with:

TypeError: can't convert String into Integer
    from FuelSDK-Ruby/lib/fuelsdk/client.rb:113:in `[]='
    from FuelSDK-Ruby/lib/fuelsdk/client.rb:113:in `AddSubscriberToList'

You can work around this with:

s.properties.first['SubscriberKey'] = subscriber_key if subscriber_key

However, this approach of setting properties to a hash and then adding additional properties is used through out the code, so the simple fix it probably the wrong one.

[BUG] HTTP::TimeoutError Write timed out after 0.25 second

Describe the bug

Savon 2.12.1 supports write_timeout option in addition of open_timeout and read_timeout savonrb/savon#834.
When we fetch data extension rows with filter, we have write_timeout error

HTTP::TimeoutError
Write timed out after 0.25 seconds

currently, this gem has defined options :

soap_client_options = {
					soap_header: header,
					wsdl: wsdl,
					endpoint: endpoint,
					wsse_auth: ["*", "*"],
					raise_errors: false,
					log: debug,
					open_timeout:180,
					read_timeout: 180,
					headers: {'User-Agent' => 'FuelSDK-Ruby-v' + MarketingCloudSDK::VERSION}
			}

To Reproduce
Steps to reproduce the behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Screenshot 2021-09-21 at 12 28 28

Code snippet

reader = MarketingCloudSDK::DataExtension::Row.new
reader.customer_key = data_extension_key
reader.props = Array(columns)
reader.filter = filter if filter
reader.authStub = auth_client

response = reader.get

Environment

  • SDK Version : 1.3.1
  • Ruby version: 2.5.1

The bug has the severity

  • Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.