ruby - How to pass filters in with Gibbon Export API call for Mailchimp -



ruby - How to pass filters in with Gibbon Export API call for Mailchimp -

i working on retrieving subscriber activity mailchimp using gibbon , campaignsubscriberactivity method of export api. using ruby 2.1.2 , gibbon 1.1.3.

i setup gibbon::export

@gibbon_export = gibbon::export.new(@api_key)

then have method loops on set of mailchimp campaign ids , retrieves activity each.

this code referenced next error.

activities = @gibbon_export.campaignsubscriberactivity({ :apikey => @api_key, :id => campaign['campaign_id'], :since => "2014-10-17 00:00:00" })

this error get:

/users/pierce/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/multi_json-1.10.1/lib/multi_json/adapter.rb:19:in `load': json::parsererror (multijson::parseerror) /users/pierce/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/multi_json-1.10.1/lib/multi_json.rb:119:in `load' /users/pierce/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gibbon-1.1.3/lib/gibbon/export.rb:26:in `call' /users/pierce/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/gibbon-1.1.3/lib/gibbon/export.rb:55:in `method_missing' mc_get_campaign_subscriber_activity.rb:63:in `block in retrieve_campaign_subscriber_activity_from_mc'

mailchimp api back upwards suggested :since parameter not formatted correctly , need encode space in date %20. however, when add together %20 :since parameter "2014-10-17%2000:00:00" still same error.

is there formatting changes need make? also, how can finish url beingness sent mailchimp can see final values?

initialize gem:

m = mailchimp::api.new(api_key_here)

first you'll need campaign id's , if don't have can run:

m.lists.list give campaigns , can id(s) accordingly.

loop on campaigns , utilize this:

m.lists.activity('campaign_id').select { |i| i["day"] == "2014-09-30" }

that give records need based on date match in yyyy-mm-dd.

ruby mailchimp gibbon

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -