Class: CyberSource::ReportsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/reports_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ ReportsApi

Returns a new instance of ReportsApi.



19
20
21
22
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 19

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_report(request_body, opts = {}) ⇒ nil

Create Adhoc Report Create one time report

Parameters:

  • request_body

    Report subscription request payload

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 28

def create_report(request_body, opts = {})
  data, _status_code, _headers = create_report_with_http_info(request_body, opts)
  return data, _status_code, _headers
end

#create_report_with_http_info(request_body, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create Adhoc Report Create one time report

Parameters:

  • request_body

    Report subscription request payload

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



38
39
40
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
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 38

def create_report_with_http_info(request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportsApi.create_report ...'
  end
  # verify the required parameter 'request_body' is set

  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling ReportsApi.create_report"
  end
  # resource path

  local_var_path = 'reporting/v3/reports'

  # query parameters

  query_params = {}

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/hal+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 = @api_client.object_to_http_body(request_body)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportsApi#create_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_report_by_report_id(report_id, opts = {}) ⇒ ReportingV3ReportsIdGet200Response

Get Report based on reportId ReportId is mandatory input

Parameters:

  • report_id

    Valid Report Id

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

Returns:



82
83
84
85
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 82

def get_report_by_report_id(report_id, opts = {})
  data, _status_code, _headers = get_report_by_report_id_with_http_info(report_id, opts)
  return data, _status_code, _headers
end

#get_report_by_report_id_with_http_info(report_id, opts = {}) ⇒ Array<(ReportingV3ReportsIdGet200Response, Fixnum, Hash)>

Get Report based on reportId ReportId is mandatory input

Parameters:

  • report_id

    Valid Report Id

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 93

def get_report_by_report_id_with_http_info(report_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportsApi.get_report_by_report_id ...'
  end
  # verify the required parameter 'report_id' is set

  if @api_client.config.client_side_validation && report_id.nil?
    fail ArgumentError, "Missing the required parameter 'report_id' when calling ReportsApi.get_report_by_report_id"
  end
  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length > 32
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling ReportsApi.get_report_by_report_id, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling ReportsApi.get_report_by_report_id, the character length must be great than or equal to 1.'
  end

  # resource path

  local_var_path = 'reporting/v3/reports/{reportId}'.sub('{' + 'reportId' + '}', report_id.to_s)

  # query parameters

  query_params = {}
  query_params[:'organizationId'] = opts[:'organization_id'] if !opts[:'organization_id'].nil?

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json', 'application/xml'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  post_body = nil
  auth_names = []
  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 => 'ReportingV3ReportsIdGet200Response')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportsApi#get_report_by_report_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_reports(start_time, end_time, time_query_type, opts = {}) ⇒ ReportingV3ReportsGet200Response

Retrieve available reports Retrieve list of available reports

Parameters:

  • start_time

    Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ssXXX

  • end_time

    Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ssXXX

  • time_query_type

    Specify time you woud like to search

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

  • :report_mime_type (String)

    Valid Report Format

  • :report_frequency (String)

    Valid Report Frequency

  • :report_name (String)

    Valid Report Name

  • :report_definition_id (Integer)

    Valid Report Definition Id

  • :report_status (String)

    Valid Report Status

Returns:



154
155
156
157
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 154

def search_reports(start_time, end_time, time_query_type, opts = {})
  data, _status_code, _headers = search_reports_with_http_info(start_time, end_time, time_query_type, opts)
  return data, _status_code, _headers
end

#search_reports_with_http_info(start_time, end_time, time_query_type, opts = {}) ⇒ Array<(ReportingV3ReportsGet200Response, Fixnum, Hash)>

Retrieve available reports Retrieve list of available reports

Parameters:

  • start_time

    Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ssXXX

  • end_time

    Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ssXXX

  • time_query_type

    Specify time you woud like to search

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Cybersource Organization Id

  • :report_mime_type (String)

    Valid Report Format

  • :report_frequency (String)

    Valid Report Frequency

  • :report_name (String)

    Valid Report Name

  • :report_definition_id (Integer)

    Valid Report Definition Id

  • :report_status (String)

    Valid Report Status

Returns:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 172

def search_reports_with_http_info(start_time, end_time, time_query_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ReportsApi.search_reports ...'
  end
  # verify the required parameter 'start_time' is set

  if @api_client.config.client_side_validation && start_time.nil?
    fail ArgumentError, "Missing the required parameter 'start_time' when calling ReportsApi.search_reports"
  end
  # verify the required parameter 'end_time' is set

  if @api_client.config.client_side_validation && end_time.nil?
    fail ArgumentError, "Missing the required parameter 'end_time' when calling ReportsApi.search_reports"
  end
  # verify the required parameter 'time_query_type' is set

  if @api_client.config.client_side_validation && time_query_type.nil?
    fail ArgumentError, "Missing the required parameter 'time_query_type' when calling ReportsApi.search_reports"
  end
  # verify enum value

  if @api_client.config.client_side_validation && !['reportTimeFrame', 'executedTime'].include?(time_query_type)
    fail ArgumentError, "invalid value for 'time_query_type', must be one of reportTimeFrame, executedTime"
  end
  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length > 32
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling ReportsApi.search_reports, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"organization_id"]" when calling ReportsApi.search_reports, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && opts[:'report_mime_type'] && !['application/xml', 'text/csv'].include?(opts[:'report_mime_type'])
    fail ArgumentError, 'invalid value for "report_mime_type", must be one of application/xml, text/csv'
  end
  if @api_client.config.client_side_validation && opts[:'report_frequency'] && !['DAILY', 'WEEKLY', 'MONTHLY', 'ADHOC'].include?(opts[:'report_frequency'])
    fail ArgumentError, 'invalid value for "report_frequency", must be one of DAILY, WEEKLY, MONTHLY, ADHOC'
  end
  if @api_client.config.client_side_validation && opts[:'report_status'] && !['COMPLETED', 'PENDING', 'QUEUED', 'RUNNING', 'ERROR', 'NO_DATA'].include?(opts[:'report_status'])
    fail ArgumentError, 'invalid value for "report_status", must be one of COMPLETED, PENDING, QUEUED, RUNNING, ERROR, NO_DATA'
  end
  # resource path

  local_var_path = 'reporting/v3/reports'

  # query parameters

  query_params = {}
  query_params[:'startTime'] = start_time
  query_params[:'endTime'] = end_time
  query_params[:'timeQueryType'] = time_query_type
  query_params[:'organizationId'] = opts[:'organization_id'] if !opts[:'organization_id'].nil?
  query_params[:'reportMimeType'] = opts[:'report_mime_type'] if !opts[:'report_mime_type'].nil?
  query_params[:'reportFrequency'] = opts[:'report_frequency'] if !opts[:'report_frequency'].nil?
  query_params[:'reportName'] = opts[:'report_name'] if !opts[:'report_name'].nil?
  query_params[:'reportDefinitionId'] = opts[:'report_definition_id'] if !opts[:'report_definition_id'].nil?
  query_params[:'reportStatus'] = opts[:'report_status'] if !opts[:'report_status'].nil?

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  post_body = nil
  auth_names = []
  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 => 'ReportingV3ReportsGet200Response')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ReportsApi#search_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end