Class: MaropostApi::Campaigns
- Inherits:
-
Object
- Object
- MaropostApi::Campaigns
- Defined in:
- lib/maropost_api/campaigns.rb
Overview
Contains methods that get various Campaign Reports based on provided parameters. The method names themselves reveal the type of reports they are getting.
Instance Method Summary collapse
-
#get(page) ⇒ Object
gets all the campaigns grouped by.
-
#get_bounce_reports(campaign_id, page) ⇒ Object
gets bounce reports for the provided.
-
#get_campaign(campaign_id) ⇒ Object
gets a campaign determined by the provided.
-
#get_click_reports(campaign_id, page, unique = nil) ⇒ Object
gets click reports for the provided.
-
#get_complaint_reports(campaign_id, page) ⇒ Object
gets complaint reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_delivered_reports(campaign_id, page) ⇒ Object
gets delivered reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_hard_bounce_reports(campaign_id, page) ⇒ Object
gets hard bounce reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_link_reports(campaign_id, page, unique = nil) ⇒ Object
gets link reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_open_reports(campaign_id, page, unique = nil) ⇒ Object
gets open reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_soft_bounce_reports(campaign_id, page) ⇒ Object
gets soft bounce reports for the provided param page [Integer] number that decides which page of result to get.
-
#get_unsubscribe_reports(campaign_id, page) ⇒ Object
gets unsubscribe reports for the provided param page [Integer] number that decides which page of result to get.
-
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ Campaigns
constructor
Creates a new instance of Reports class.
Constructor Details
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ Campaigns
Creates a new instance of Reports class.
11 12 13 14 |
# File 'lib/maropost_api/campaigns.rb', line 11 def initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) MaropostApi.instance_variable_set(:@api_key, api_key) MaropostApi.instance_variable_set(:@account, account) end |
Instance Method Details
#get(page) ⇒ Object
gets all the campaigns grouped by
19 20 21 22 23 24 |
# File 'lib/maropost_api/campaigns.rb', line 19 def get(page) full_path = full_resource_path('') query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |
#get_bounce_reports(campaign_id, page) ⇒ Object
gets bounce reports for the provided
40 41 42 43 44 45 |
# File 'lib/maropost_api/campaigns.rb', line 40 def get_bounce_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/bounce_report") query_params = MaropostApi.set_query_params({page:page}) MaropostApi.get_result(full_path, query_params) end |
#get_campaign(campaign_id) ⇒ Object
gets a campaign determined by the provided
29 30 31 32 33 34 |
# File 'lib/maropost_api/campaigns.rb', line 29 def get_campaign(campaign_id) full_path = full_resource_path("/#{campaign_id}") query_params = MaropostApi.set_query_params() MaropostApi.get_result(full_path, query_params) end |
#get_click_reports(campaign_id, page, unique = nil) ⇒ Object
gets click reports for the provided
52 53 54 55 56 57 58 |
# File 'lib/maropost_api/campaigns.rb', line 52 def get_click_reports(campaign_id, page, unique = nil) full_path = full_resource_path("/#{campaign_id}/click_report") query_params = MaropostApi.set_query_params({page: page}) query_params[:query][:unique] = unique unless unique.nil? MaropostApi.get_result(full_path, query_params) end |
#get_complaint_reports(campaign_id, page) ⇒ Object
gets complaint reports for the provided param page [Integer] number that decides which page of result to get
64 65 66 67 68 69 |
# File 'lib/maropost_api/campaigns.rb', line 64 def get_complaint_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/complaint_report") query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |
#get_delivered_reports(campaign_id, page) ⇒ Object
gets delivered reports for the provided param page [Integer] number that decides which page of result to get
75 76 77 78 79 80 |
# File 'lib/maropost_api/campaigns.rb', line 75 def get_delivered_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/delivered_report") query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |
#get_hard_bounce_reports(campaign_id, page) ⇒ Object
gets hard bounce reports for the provided param page [Integer] number that decides which page of result to get
86 87 88 89 90 91 |
# File 'lib/maropost_api/campaigns.rb', line 86 def get_hard_bounce_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/hard_bounce_report") query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |
#get_link_reports(campaign_id, page, unique = nil) ⇒ Object
gets link reports for the provided param page [Integer] number that decides which page of result to get
132 133 134 135 136 137 138 |
# File 'lib/maropost_api/campaigns.rb', line 132 def get_link_reports(campaign_id, page, unique = nil) full_path = full_resource_path("/#{campaign_id}/link_report") query_params = MaropostApi.set_query_params({page: page}) query_params[:query][:unique] = unique unless unique.nil? MaropostApi.get_result(full_path, query_params) end |
#get_open_reports(campaign_id, page, unique = nil) ⇒ Object
gets open reports for the provided param page [Integer] number that decides which page of result to get
109 110 111 112 113 114 115 |
# File 'lib/maropost_api/campaigns.rb', line 109 def get_open_reports(campaign_id, page, unique = nil) full_path = full_resource_path("/#{campaign_id}/open_report") query_params = MaropostApi.set_query_params({page: page}) query_params[:query][:unique] = unique unless unique.nil? MaropostApi.get_result(full_path, query_params) end |
#get_soft_bounce_reports(campaign_id, page) ⇒ Object
gets soft bounce reports for the provided param page [Integer] number that decides which page of result to get
97 98 99 100 101 102 |
# File 'lib/maropost_api/campaigns.rb', line 97 def get_soft_bounce_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/soft_bounce_report") query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |
#get_unsubscribe_reports(campaign_id, page) ⇒ Object
gets unsubscribe reports for the provided param page [Integer] number that decides which page of result to get
121 122 123 124 125 126 |
# File 'lib/maropost_api/campaigns.rb', line 121 def get_unsubscribe_reports(campaign_id, page) full_path = full_resource_path("/#{campaign_id}/unsubscribe_report") query_params = MaropostApi.set_query_params({page: page}) MaropostApi.get_result(full_path, query_params) end |