Class: Mailtrap::MarketingStatsAPI
- Inherits:
-
Object
- Object
- Mailtrap::MarketingStatsAPI
- Includes:
- BaseAPI, StatsQueryParams
- Defined in:
- lib/mailtrap/marketing_stats_api.rb
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#get(start_date:, end_date:, sending_domain_ids: nil, sources: nil, email_service_providers: nil) ⇒ MarketingStats
Get aggregated Email Marketing stats: campaigns and automations together, the same numbers as Email Marketing > Stats Overview in the app.
-
#initialize(client = Mailtrap::Client.new) ⇒ MarketingStatsAPI
constructor
A new instance of MarketingStatsAPI.
Methods included from BaseAPI
Constructor Details
#initialize(client = Mailtrap::Client.new) ⇒ MarketingStatsAPI
Returns a new instance of MarketingStatsAPI.
13 14 15 |
# File 'lib/mailtrap/marketing_stats_api.rb', line 13 def initialize(client = Mailtrap::Client.new) @client = client end |
Instance Method Details
#get(start_date:, end_date:, sending_domain_ids: nil, sources: nil, email_service_providers: nil) ⇒ MarketingStats
Get aggregated Email Marketing stats: campaigns and automations together, the same numbers as Email Marketing > Stats Overview in the app. Email API/SMTP traffic is reported by StatsAPI.
28 29 30 31 32 33 34 35 |
# File 'lib/mailtrap/marketing_stats_api.rb', line 28 def get(start_date:, end_date:, sending_domain_ids: nil, sources: nil, email_service_providers: nil) query_params = build_query_params( start_date, end_date, { sending_domain_ids:, sources:, email_service_providers: } ) response = client.get(base_path, query_params) build_entity(response[:data], MarketingStats) end |