Class: Smtpcom::Sendapi::StatsSummary
- Inherits:
-
ApiResource
- Object
- ApiResource
- Smtpcom::Sendapi::StatsSummary
- Defined in:
- lib/smtpcom/sendapi/stats_summary.rb
Instance Attribute Summary collapse
-
#campaign ⇒ Object
readonly
Returns the value of attribute campaign.
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#sender ⇒ Object
readonly
Returns the value of attribute sender.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #all ⇒ Object
- #csv ⇒ Object
-
#initialize(start, finish, sender = nil, campaign = nil) ⇒ StatsSummary
constructor
A new instance of StatsSummary.
- #prepare_params ⇒ Object
Methods inherited from ApiResource
#_get, #_get_raw, #_post, build_from_response
Methods included from Request
Constructor Details
#initialize(start, finish, sender = nil, campaign = nil) ⇒ StatsSummary
Returns a new instance of StatsSummary.
6 7 8 9 10 11 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 6 def initialize(start, finish, sender = nil, campaign = nil) @start = start @finish = finish @sender = sender @campaign = campaign end |
Instance Attribute Details
#campaign ⇒ Object (readonly)
Returns the value of attribute campaign.
4 5 6 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 4 def campaign @campaign end |
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
4 5 6 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 4 def finish @finish end |
#sender ⇒ Object (readonly)
Returns the value of attribute sender.
4 5 6 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 4 def sender @sender end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
4 5 6 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 4 def start @start end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
4 5 6 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 4 def total @total end |
Instance Method Details
#all ⇒ Object
13 14 15 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 13 def all format_response _get('/summarystats/get', prepare_params) end |
#csv ⇒ Object
17 18 19 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 17 def csv _get_raw('/summarystatsexport/get', prepare_params.merge(headers: { 'Accept' => 'text/csv' })) end |
#prepare_params ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/smtpcom/sendapi/stats_summary.rb', line 21 def prepare_params attributes = { DateFrom: @start.strftime("%m/%d/%Y"), DateTo: @finish.strftime("%m/%d/%Y") } attributes[:Sender] = @sender if @sender attributes[:CampaignID] = @campaign if @campaign attributes end |