Class: SendGrid::EmailStats
- Inherits:
-
Object
- Object
- SendGrid::EmailStats
- Defined in:
- lib/sendgrid/helpers/stats/email_stats.rb
Instance Method Summary collapse
- #by_day(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
- #by_month(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
- #by_week(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
- #get(aggregated_by, start_date, end_date, categories = nil, subusers = nil) ⇒ Object
-
#initialize(args) ⇒ EmailStats
constructor
A new instance of EmailStats.
Constructor Details
#initialize(args) ⇒ EmailStats
Returns a new instance of EmailStats.
5 6 7 |
# File 'lib/sendgrid/helpers/stats/email_stats.rb', line 5 def initialize(args) @sendgrid_client = args[:sendgrid_client] end |
Instance Method Details
#by_day(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
9 10 11 |
# File 'lib/sendgrid/helpers/stats/email_stats.rb', line 9 def by_day(start_date, end_date, categories = nil, subusers = nil) get('day', start_date, end_date, categories, subusers) end |
#by_month(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
17 18 19 |
# File 'lib/sendgrid/helpers/stats/email_stats.rb', line 17 def by_month(start_date, end_date, categories = nil, subusers = nil) get('month', start_date, end_date, categories, subusers) end |
#by_week(start_date, end_date, categories = nil, subusers = nil) ⇒ Object
13 14 15 |
# File 'lib/sendgrid/helpers/stats/email_stats.rb', line 13 def by_week(start_date, end_date, categories = nil, subusers = nil) get('week', start_date, end_date, categories, subusers) end |
#get(aggregated_by, start_date, end_date, categories = nil, subusers = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/sendgrid/helpers/stats/email_stats.rb', line 21 def get(aggregated_by, start_date, end_date, categories = nil, subusers = nil) params = query_params(aggregated_by, start_date, end_date, categories, subusers) response_body = @sendgrid_client.stats.get(query_params: params).body build_response(response_body) end |