class Mimepost::StatsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/mimepost/api/stats_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

emaillogs_get(start_date, end_date, opts = {}) click to toggle source

Get the logs of a particular date @param start_date Start Date in yyyymmdd format example 20190801 @param end_date End Date in yyyymmdd format example 20190803 @param [Hash] opts the optional parameters @option opts [String] :status @option opts [String] :to @option opts [Integer] :page @option opts [Integer] :limit @return [ApiResponseEmaillogs]

# File lib/mimepost/api/stats_api.rb, line 31
def emaillogs_get(start_date, end_date, opts = {})
  data, _status_code, _headers = emaillogs_get_with_http_info(start_date, end_date, opts)
  data
end
emaillogs_get_with_http_info(start_date, end_date, opts = {}) click to toggle source

Get the logs of a particular date @param start_date Start Date in yyyymmdd format example 20190801 @param end_date End Date in yyyymmdd format example 20190803 @param [Hash] opts the optional parameters @option opts [String] :status @option opts [String] :to @option opts [Integer] :page @option opts [Integer] :limit @return [Array<(ApiResponseEmaillogs, Fixnum, Hash)>] ApiResponseEmaillogs data, response status code and response headers

# File lib/mimepost/api/stats_api.rb, line 45
def emaillogs_get_with_http_info(start_date, end_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatsApi.emaillogs_get ...'
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling StatsApi.emaillogs_get"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling StatsApi.emaillogs_get"
  end
  if @api_client.config.client_side_validation && opts[:'status'] && !['request', 'delivered', 'open', 'click', 'unsubscribe', 'bounce_soft', 'bounce_hard', 'block_soft', 'block_hard', 'spam'].include?(opts[:'status'])
    fail ArgumentError, 'invalid value for "status", must be one of request, delivered, open, click, unsubscribe, bounce_soft, bounce_hard, block_soft, block_hard, spam'
  end
  # resource path
  local_var_path = '/emaillogs/'

  # query parameters
  query_params = {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseEmaillogs')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StatsApi#emaillogs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
stats_get(start_date, end_date, opts = {}) click to toggle source

Get the summary of stats for a range of dates @param start_date Start Date in yyyymmdd format example 20190801 @param end_date End Date in yyyymmdd format example 20190803 @param [Hash] opts the optional parameters @return [ApiResponseStats]

# File lib/mimepost/api/stats_api.rb, line 102
def stats_get(start_date, end_date, opts = {})
  data, _status_code, _headers = stats_get_with_http_info(start_date, end_date, opts)
  data
end
stats_get_with_http_info(start_date, end_date, opts = {}) click to toggle source

Get the summary of stats for a range of dates @param start_date Start Date in yyyymmdd format example 20190801 @param end_date End Date in yyyymmdd format example 20190803 @param [Hash] opts the optional parameters @return [Array<(ApiResponseStats, Fixnum, Hash)>] ApiResponseStats data, response status code and response headers

# File lib/mimepost/api/stats_api.rb, line 112
def stats_get_with_http_info(start_date, end_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: StatsApi.stats_get ...'
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling StatsApi.stats_get"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling StatsApi.stats_get"
  end
  # resource path
  local_var_path = '/stats/'

  # query parameters
  query_params = {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseStats')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StatsApi#stats_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end