Class: Mimepost::StatsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mimepost/api/stats_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ StatsApi

Returns a new instance of StatsApi.



19
20
21
# File 'lib/mimepost/api/stats_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mimepost/api/stats_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#emaillogs_get(start_date, end_date, opts = {}) ⇒ ApiResponseEmaillogs

Get the logs of a particular date

Parameters:

  • start_date

    Start Date in yyyymmdd format example 20190801

  • end_date

    End Date in yyyymmdd format example 20190803

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :to (String)
  • :page (Integer)
  • :limit (Integer)

Returns:



31
32
33
34
# 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 = {}) ⇒ Array<(ApiResponseEmaillogs, Fixnum, Hash)>

Get the logs of a particular date

Parameters:

  • start_date

    Start Date in yyyymmdd format example 20190801

  • end_date

    End Date in yyyymmdd format example 20190803

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :to (String)
  • :page (Integer)
  • :limit (Integer)

Returns:

  • (Array<(ApiResponseEmaillogs, Fixnum, Hash)>)

    ApiResponseEmaillogs data, response status code and response headers



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
# 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 = {}) ⇒ ApiResponseStats

Get the summary of stats for a range of dates

Parameters:

  • start_date

    Start Date in yyyymmdd format example 20190801

  • end_date

    End Date in yyyymmdd format example 20190803

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



102
103
104
105
# 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 = {}) ⇒ Array<(ApiResponseStats, Fixnum, Hash)>

Get the summary of stats for a range of dates

Parameters:

  • start_date

    Start Date in yyyymmdd format example 20190801

  • end_date

    End Date in yyyymmdd format example 20190803

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiResponseStats, Fixnum, Hash)>)

    ApiResponseStats data, response status code and response headers



112
113
114
115
116
117
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
# 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