lib/createsend/campaign.rb in createsend-1.1.1 vs lib/createsend/campaign.rb in createsend-2.0.0

- old
+ new

@@ -9,13 +9,13 @@ def initialize(campaign_id) @campaign_id = campaign_id end # Creates a new campaign for a client. - def self.create(client_id, subject, name, from_name, from_email, reply_to, html_url, - text_url, list_ids, segment_ids) - options = { :body => { + def self.create(client_id, subject, name, from_name, from_email, + reply_to, html_url, text_url, list_ids, segment_ids) + options = { :body => { :Subject => subject, :Name => name, :FromName => from_name, :FromEmail => from_email, :ReplyTo => reply_to, @@ -28,11 +28,12 @@ end # Sends a preview of this campaign. def send_preview(recipients, personalize="fallback") options = { :body => { - :PreviewRecipients => recipients.kind_of?(String) ? [ recipients ] : recipients, + :PreviewRecipients => recipients.kind_of?(String) ? + [ recipients ] : recipients, :Personalize => personalize }.to_json } response = post "sendpreview", options end # Sends this campaign. @@ -58,65 +59,71 @@ def summary response = get "summary", {} Hashie::Mash.new(response) end - # Retrieves the lists and segments to which this campaaign will be (or was) sent. + # Retrieves the lists and segments to which this campaaign will + # be (or was) sent. def lists_and_segments response = get "listsandsegments", {} Hashie::Mash.new(response) end # Retrieves the recipients of this campaign. - def recipients(page=1, page_size=1000, order_field="email", order_direction="asc") - options = { :query => { + def recipients(page=1, page_size=1000, order_field="email", + order_direction="asc") + options = { :query => { :page => page, :pagesize => page_size, :orderfield => order_field, :orderdirection => order_direction } } response = get 'recipients', options Hashie::Mash.new(response) end # Retrieves the opens for this campaign. - def opens(date, page=1, page_size=1000, order_field="date", order_direction="asc") - options = { :query => { + def opens(date, page=1, page_size=1000, order_field="date", + order_direction="asc") + options = { :query => { :date => date, :page => page, :pagesize => page_size, :orderfield => order_field, :orderdirection => order_direction } } response = get "opens", options Hashie::Mash.new(response) end # Retrieves the subscriber clicks for this campaign. - def clicks(date, page=1, page_size=1000, order_field="date", order_direction="asc") - options = { :query => { + def clicks(date, page=1, page_size=1000, order_field="date", + order_direction="asc") + options = { :query => { :date => date, :page => page, :pagesize => page_size, :orderfield => order_field, :orderdirection => order_direction } } response = get "clicks", options Hashie::Mash.new(response) end # Retrieves the unsubscribes for this campaign. - def unsubscribes(date, page=1, page_size=1000, order_field="date", order_direction="asc") - options = { :query => { + def unsubscribes(date, page=1, page_size=1000, order_field="date", + order_direction="asc") + options = { :query => { :date => date, :page => page, :pagesize => page_size, :orderfield => order_field, :orderdirection => order_direction } } response = get "unsubscribes", options Hashie::Mash.new(response) end # Retrieves the bounces for this campaign. - def bounces(date="1900-01-01", page=1, page_size=1000, order_field="date", order_direction="asc") - options = { :query => { + def bounces(date="1900-01-01", page=1, page_size=1000, order_field="date", + order_direction="asc") + options = { :query => { :date => date, :page => page, :pagesize => page_size, :orderfield => order_field, :orderdirection => order_direction } } \ No newline at end of file