CreateSend::Campaign.get troubleshooting - Ruby Wrapper

Hi Everyone,

I'm using the ruby CreateSend gem and Im trying to figure out how to pass params to Campaign.get. For example I'd like to set PageSize or PageNumber.

Right now I can get a campaign with

campaign = @auth, "CAMPAIGNID"

But I cant figure out how to pass any more params. Is this possible?

CreateSend::Campaign has a get() method, but the test specs use FakeWeb.register_uri to make api calls, so i'm beginning to doubt that these sort of calls are supported by the wrapper.

Any help would be great


Ken Ken, 3 years ago

Hi Hans,

The get() method for CreateSend::Campaign is private, so you shouldn't be able to access it. All the public methods for CreateSend::Campaign call the Campaign routes of our API (, and all parameters should be accounted for and you shouldn't need to add any more.

The tests in the repository are meant to be unit tests for the wrapper, so we do want the calls to go to  FakeWeb.register_uri.

Let me know what it is you're trying to do, and I'll endeavour to help you.

hans, 3 years ago

HI Ken,

Thanks for the quick response.

Here is what has me confused.

I can create a campaign with

campaign = @auth, 'campaignID'

and I can call

campaign.opens or campaign.recipients

but what I can't figure out is how to set params for calls like campaign.opens or campaign.recipients.

The API documentation  lists all sorts of params (PageSize, Date, Page, OrderField) and how to set them in URL query strings. I just can't find any documentation on how to do anything similar with the ruby wrapper.

The reason I'm after this is that I'm trying to get a count of weekly active users of our email list, so being able to filter opens by date would be amazing.



Ken Ken, 3 years ago

Hi Hans,

I think you want some code something like:

date = '20140112'
campaign = @auth, 'campaignID'
opens = campaign.opens(date, 1, 10000, 'date', 'desc')

opens.Results.each do |open|
  # this will loop through all the opens made from 'date'

Basically it's making a call to the campaign opens method ( with the parameters of 'date' for the Date, 1 for the Page, 10000 for the PageSize, date for the OrderField, and desc for the OrderDirection.

I hope that makes sense.

hans, 3 years ago

Hey! This is perfect. You guys really need some documentation on this! Or maybe I missed it. But yeah this is exactly what I was trying to figure out. Thanks

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free