Class: MaropostApi::Reports
- Inherits:
-
Object
- Object
- MaropostApi::Reports
- Defined in:
- lib/maropost_api/reports.rb
Overview
Contains methods that get 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 reports grouped by
page
(Integer). -
#get_ab_reports(name:, page:, from: nil, to: nil, per: nil) ⇒ Object
gets all ab reports described by.
-
#get_bounces(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil, type: nil) ⇒ Object
gets all bounce reports described by.
-
#get_clicks(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all click reports described by.
-
#get_complaints(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all complaint reports described by.
-
#get_journeys(page) ⇒ Object
gets all journey reports for the provided
page
. -
#get_opens(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all open reports described by.
-
#get_report(id) ⇒ Object
gets a report defined by its unique
id
(Integer). -
#get_unsubscribes(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all unsubscribe reports described by.
-
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ Reports
constructor
Creates a new instance of Reports class.
Constructor Details
#initialize(account = ENV["ACCOUNT"], api_key = ENV["API_KEY"]) ⇒ Reports
Creates a new instance of Reports class.
11 12 13 14 |
# File 'lib/maropost_api/reports.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 reports grouped by page
(Integer)
18 19 20 21 22 23 |
# File 'lib/maropost_api/reports.rb', line 18 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_ab_reports(name:, page:, from: nil, to: nil, per: nil) ⇒ Object
gets all ab reports described by
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/maropost_api/reports.rb', line 147 def get_ab_reports(name:, page:, from: nil, to: nil, per: nil) full_path = full_resource_path('', "ab_reports") params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |
#get_bounces(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil, type: nil) ⇒ Object
gets all bounce reports described by
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/maropost_api/reports.rb', line 87 def get_bounces(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil, type: nil) full_path = full_resource_path "/bounces" params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |
#get_clicks(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all click reports described by
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/maropost_api/reports.rb', line 65 def get_clicks(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) full_path = full_resource_path "/clicks" params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |
#get_complaints(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all complaint reports described by
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/maropost_api/reports.rb', line 129 def get_complaints(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) full_path = full_resource_path "/unsubscribes" params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |
#get_journeys(page) ⇒ Object
gets all journey reports for the provided page
161 162 163 164 165 166 |
# File 'lib/maropost_api/reports.rb', line 161 def get_journeys(page) full_path = full_resource_path '/journeys' query_params = MaropostApi.set_query_params({:page => page}) MaropostApi.get_result(full_path, query_params) end |
#get_opens(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all open reports described by
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/maropost_api/reports.rb', line 44 def get_opens(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) full_path = full_resource_path "/opens" params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |
#get_report(id) ⇒ Object
gets a report defined by its unique id
(Integer)
27 28 29 30 31 32 |
# File 'lib/maropost_api/reports.rb', line 27 def get_report(id) full_path = full_resource_path "/#{id}" query_params = MaropostApi.set_query_params MaropostApi.get_result(full_path, query_params) end |
#get_unsubscribes(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) ⇒ Object
gets all unsubscribe reports described by
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/maropost_api/reports.rb', line 108 def get_unsubscribes(page:, fields: [], from: nil, to: nil, unique: nil, email: nil, uid: nil, per: nil) full_path = full_resource_path "/unsubscribes" params = {} method(__method__).parameters.each{|p| params[p[1]] = eval(p[1].to_s)} params.reject!{|k,v| v.nil? or (v.respond_to? :empty? and v.empty?) } query_params = MaropostApi.set_query_params(params) MaropostApi.get_result(full_path, query_params) end |