Class: Sendpost::StatsApi
- Inherits:
-
Object
- Object
- Sendpost::StatsApi
- Defined in:
- lib/sendpost_ruby_sdk/api/stats_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#account_subaccount_stat_subaccount_id_aggregate_get(from, to, subaccount_id, opts = {}) ⇒ AggregateStat
Get Aggregate Stats Retrieve summarized email statistics for a sub-account over a date range.
-
#account_subaccount_stat_subaccount_id_aggregate_get_with_http_info(from, to, subaccount_id, opts = {}) ⇒ Array<(AggregateStat, Integer, Hash)>
Get Aggregate Stats Retrieve summarized email statistics for a sub-account over a date range.
-
#account_subaccount_stat_subaccount_id_get(from, to, subaccount_id, opts = {}) ⇒ Array<Stat>
List Stats Retrieve daily email statistics for a specific sub-account.
-
#account_subaccount_stat_subaccount_id_get_with_http_info(from, to, subaccount_id, opts = {}) ⇒ Array<(Array<Stat>, Integer, Hash)>
List Stats Retrieve daily email statistics for a specific sub-account.
-
#get_aggregate_stats_by_group(group, from, to, subaccount_id, opts = {}) ⇒ AggregateStat
Get Group Aggregate Stats Retrieve aggregated email statistics filtered by a specific group/tag.
-
#get_aggregate_stats_by_group_with_http_info(group, from, to, subaccount_id, opts = {}) ⇒ Array<(AggregateStat, Integer, Hash)>
Get Group Aggregate Stats Retrieve aggregated email statistics filtered by a specific group/tag.
-
#initialize(api_client = ApiClient.default) ⇒ StatsApi
constructor
A new instance of StatsApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#account_subaccount_stat_subaccount_id_aggregate_get(from, to, subaccount_id, opts = {}) ⇒ AggregateStat
Get Aggregate Stats
Retrieve summarized email statistics for a sub-account over a date range. Unlike daily stats, this returns a single record with totals across all days—ideal for high-level reporting. Response includes total counts for: - processed - Total emails submitted - delivered - Successfully delivered - dropped - Blocked before sending - hardBounced / softBounced - Bounce breakdowns - opens / clicks - Engagement totals - unsubscribed / spams - Negative signals Use Cases: - Monthly performance reports - Executive dashboards - Billing period summaries - Year-over-year comparisons - SLA compliance reports Example: To get Q1 2024 totals: GET /account/subaccount/stat/11/aggregate?from=2024-01-01&to=2024-03-31 Note: Maximum date range is 366 days (1 year).
29 30 31 32 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 29 def account_subaccount_stat_subaccount_id_aggregate_get(from, to, subaccount_id, opts = {}) data, _status_code, _headers = account_subaccount_stat_subaccount_id_aggregate_get_with_http_info(from, to, subaccount_id, opts) data end |
#account_subaccount_stat_subaccount_id_aggregate_get_with_http_info(from, to, subaccount_id, opts = {}) ⇒ Array<(AggregateStat, Integer, Hash)>
Get Aggregate Stats Retrieve summarized email statistics for a sub-account over a date range. Unlike daily stats, this returns a single record with totals across all days—ideal for high-level reporting. Response includes total counts for: - `processed` - Total emails submitted - `delivered` - Successfully delivered - `dropped` - Blocked before sending - `hardBounced` / `softBounced` - Bounce breakdowns - `opens` / `clicks` - Engagement totals - `unsubscribed` / `spams` - Negative signals Use Cases: - Monthly performance reports - Executive dashboards - Billing period summaries - Year-over-year comparisons - SLA compliance reports Example: To get Q1 2024 totals: ``` GET /account/subaccount/stat/11/aggregate?from=2024-01-01&to=2024-03-31 ``` Note: Maximum date range is 366 days (1 year).
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 41 def account_subaccount_stat_subaccount_id_aggregate_get_with_http_info(from, to, subaccount_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: StatsApi.account_subaccount_stat_subaccount_id_aggregate_get ...' end # verify the required parameter 'from' is set if @api_client.config.client_side_validation && from.nil? fail ArgumentError, "Missing the required parameter 'from' when calling StatsApi.account_subaccount_stat_subaccount_id_aggregate_get" end # verify the required parameter 'to' is set if @api_client.config.client_side_validation && to.nil? fail ArgumentError, "Missing the required parameter 'to' when calling StatsApi.account_subaccount_stat_subaccount_id_aggregate_get" end # verify the required parameter 'subaccount_id' is set if @api_client.config.client_side_validation && subaccount_id.nil? fail ArgumentError, "Missing the required parameter 'subaccount_id' when calling StatsApi.account_subaccount_stat_subaccount_id_aggregate_get" end # resource path local_var_path = '/account/subaccount/stat/{subaccount_id}/aggregate'.sub('{' + 'subaccount_id' + '}', CGI.escape(subaccount_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'from'] = from query_params[:'to'] = to # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AggregateStat' # auth_names auth_names = opts[:debug_auth_names] || ['accountAuth'] = opts.merge( :operation => :"StatsApi.account_subaccount_stat_subaccount_id_aggregate_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: StatsApi#account_subaccount_stat_subaccount_id_aggregate_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#account_subaccount_stat_subaccount_id_get(from, to, subaccount_id, opts = {}) ⇒ Array<Stat>
List Stats
Retrieve daily email statistics for a specific sub-account. Returns one record per day within the date range, perfect for charting trends and identifying patterns. Metrics Per Day: | Metric | Description | |--------|-------------| | processed | Emails submitted to SendPost | | delivered | Successfully delivered to recipient's mailbox | | dropped | Blocked before sending (suppressed, invalid, etc.) | | hardBounced | Permanent failures (invalid address, domain doesn't exist) | | softBounced | Temporary failures (mailbox full, server down) | | opens | Total email opens (includes multiple opens per recipient) | | clicks | Total link clicks | | unsubscribed | Recipients who unsubscribed | | spams | Emails marked as spam by recipients | Key Rates to Calculate: - Delivery Rate = delivered / processed × 100 - Open Rate = opens / delivered × 100 - Click Rate = clicks / delivered × 100 - Bounce Rate = (hardBounced + softBounced) / processed × 100 Use Cases: - Daily performance dashboard - Week-over-week trend analysis - Identifying delivery issues early - SLA monitoring and reporting Note: Maximum date range is 31 days. Both from and to dates are inclusive.
106 107 108 109 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 106 def account_subaccount_stat_subaccount_id_get(from, to, subaccount_id, opts = {}) data, _status_code, _headers = account_subaccount_stat_subaccount_id_get_with_http_info(from, to, subaccount_id, opts) data end |
#account_subaccount_stat_subaccount_id_get_with_http_info(from, to, subaccount_id, opts = {}) ⇒ Array<(Array<Stat>, Integer, Hash)>
List Stats Retrieve daily email statistics for a specific sub-account. Returns one record per day within the date range, perfect for charting trends and identifying patterns. Metrics Per Day: | Metric | Description | |--------|-------------| | `processed` | Emails submitted to SendPost | | `delivered` | Successfully delivered to recipient's mailbox | | `dropped` | Blocked before sending (suppressed, invalid, etc.) | | `hardBounced` | Permanent failures (invalid address, domain doesn't exist) | | `softBounced` | Temporary failures (mailbox full, server down) | | `opens` | Total email opens (includes multiple opens per recipient) | | `clicks` | Total link clicks | | `unsubscribed` | Recipients who unsubscribed | | `spams` | Emails marked as spam by recipients | Key Rates to Calculate: - Delivery Rate = `delivered / processed × 100` - Open Rate = `opens / delivered × 100` - Click Rate = `clicks / delivered × 100` - Bounce Rate = `(hardBounced + softBounced) / processed × 100` Use Cases: - Daily performance dashboard - Week-over-week trend analysis - Identifying delivery issues early - SLA monitoring and reporting Note: Maximum date range is 31 days. Both `from` and `to` dates are inclusive.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 118 def account_subaccount_stat_subaccount_id_get_with_http_info(from, to, subaccount_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: StatsApi.account_subaccount_stat_subaccount_id_get ...' end # verify the required parameter 'from' is set if @api_client.config.client_side_validation && from.nil? fail ArgumentError, "Missing the required parameter 'from' when calling StatsApi.account_subaccount_stat_subaccount_id_get" end # verify the required parameter 'to' is set if @api_client.config.client_side_validation && to.nil? fail ArgumentError, "Missing the required parameter 'to' when calling StatsApi.account_subaccount_stat_subaccount_id_get" end # verify the required parameter 'subaccount_id' is set if @api_client.config.client_side_validation && subaccount_id.nil? fail ArgumentError, "Missing the required parameter 'subaccount_id' when calling StatsApi.account_subaccount_stat_subaccount_id_get" end # resource path local_var_path = '/account/subaccount/stat/{subaccount_id}'.sub('{' + 'subaccount_id' + '}', CGI.escape(subaccount_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'from'] = from query_params[:'to'] = to # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<Stat>' # auth_names auth_names = opts[:debug_auth_names] || ['accountAuth'] = opts.merge( :operation => :"StatsApi.account_subaccount_stat_subaccount_id_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: StatsApi#account_subaccount_stat_subaccount_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_aggregate_stats_by_group(group, from, to, subaccount_id, opts = {}) ⇒ AggregateStat
Get Group Aggregate Stats
Retrieve aggregated email statistics filtered by a specific group/tag. Groups are labels you assign when sending emails to categorize and segment your analytics. What are Groups? Groups (also called tags) are strings you attach to emails when sending. They help you: - Track different email types (transactional vs marketing) - Segment by campaign or feature - Compare performance across categories Setting Groups When Sending: json { \"from\": { \"email\": \"[email protected]\" }, \"to\": [{ \"email\": \"[email protected]\" }], \"subject\": \"Order Confirmation\", \"groups\": [\"order-confirmations\", \"transactional\"] } Use Cases: - Compare welcome email vs password reset performance - Track marketing campaign performance by campaign ID - Measure transactional vs promotional email metrics - Analyze A/B test results by variant group Example: Get stats for "welcome-emails" group: GET /account/subaccount/stat/11/group?group=welcome-emails&from=2024-01-01&to=2024-03-31 Note: Maximum date range is 366 days.
184 185 186 187 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 184 def get_aggregate_stats_by_group(group, from, to, subaccount_id, opts = {}) data, _status_code, _headers = get_aggregate_stats_by_group_with_http_info(group, from, to, subaccount_id, opts) data end |
#get_aggregate_stats_by_group_with_http_info(group, from, to, subaccount_id, opts = {}) ⇒ Array<(AggregateStat, Integer, Hash)>
Get Group Aggregate Stats Retrieve aggregated email statistics filtered by a specific group/tag. Groups are labels you assign when sending emails to categorize and segment your analytics. What are Groups? Groups (also called tags) are strings you attach to emails when sending. They help you: - Track different email types (transactional vs marketing) - Segment by campaign or feature - Compare performance across categories Setting Groups When Sending: ```json { "from": { "email": "[email protected]" }, "to": [{ "email": "[email protected]" }], "subject": "Order Confirmation", "groups": ["order-confirmations", "transactional"] } ``` Use Cases: - Compare welcome email vs password reset performance - Track marketing campaign performance by campaign ID - Measure transactional vs promotional email metrics - Analyze A/B test results by variant group Example: Get stats for "welcome-emails" group: ``` GET /account/subaccount/stat/11/group?group=welcome-emails&from=2024-01-01&to=2024-03-31 ``` Note: Maximum date range is 366 days.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/sendpost_ruby_sdk/api/stats_api.rb', line 197 def get_aggregate_stats_by_group_with_http_info(group, from, to, subaccount_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: StatsApi.get_aggregate_stats_by_group ...' end # verify the required parameter 'group' is set if @api_client.config.client_side_validation && group.nil? fail ArgumentError, "Missing the required parameter 'group' when calling StatsApi.get_aggregate_stats_by_group" end # verify the required parameter 'from' is set if @api_client.config.client_side_validation && from.nil? fail ArgumentError, "Missing the required parameter 'from' when calling StatsApi.get_aggregate_stats_by_group" end # verify the required parameter 'to' is set if @api_client.config.client_side_validation && to.nil? fail ArgumentError, "Missing the required parameter 'to' when calling StatsApi.get_aggregate_stats_by_group" end # verify the required parameter 'subaccount_id' is set if @api_client.config.client_side_validation && subaccount_id.nil? fail ArgumentError, "Missing the required parameter 'subaccount_id' when calling StatsApi.get_aggregate_stats_by_group" end # resource path local_var_path = '/account/subaccount/stat/{subaccount_id}/group'.sub('{' + 'subaccount_id' + '}', CGI.escape(subaccount_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'group'] = group query_params[:'from'] = from query_params[:'to'] = to # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AggregateStat' # auth_names auth_names = opts[:debug_auth_names] || ['accountAuth'] = opts.merge( :operation => :"StatsApi.get_aggregate_stats_by_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: StatsApi#get_aggregate_stats_by_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |