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(create_adhoc_report_request, opts = {}) ⇒ nil

Create Adhoc Report Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](www.cybersource.com/developers/documentation/reporting_and_reconciliation)

Parameters:

  • create_adhoc_report_request

    Report subscription request payload

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

Returns:

  • (nil)


31
32
33
34
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 31

def create_report(create_adhoc_report_request, opts = {})
  data, status_code, headers = create_report_with_http_info(create_adhoc_report_request, opts)
  return data, status_code, headers
end

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

Create Adhoc Report Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](www.cybersource.com/developers/documentation/reporting_and_reconciliation)

Parameters:

  • create_adhoc_report_request

    Report subscription request payload

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

Returns:

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

    nil, response status code and response headers



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/cybersource_rest_client/api/reports_api.rb', line 42

def create_report_with_http_info(create_adhoc_report_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: ReportsApi.create_report ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'create_adhoc_report_request' is set
  if @api_client.config.client_side_validation && create_adhoc_report_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_adhoc_report_request' when calling ReportsApi.create_report"
  end
  #if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'] !~ Regexp.new(/[a-zA-Z0-9-_]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"organization_id\"]' when calling ReportsApi.create_report, must conform to the pattern /[a-zA-Z0-9-_]+/."
  #end

  # resource path
  local_var_path = 'reporting/v3/reports'

  # 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'])
  # 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(create_adhoc_report_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreateAdhocReportRequest', @api_client.config.host)
  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
    begin
    raise
        @api_client.config.logger.debug "API called: ReportsApi#create_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

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

Get Report Based on Report Id Download a report using the reportId value. If you don’t already know this value, you can obtain it using the Retrieve available reports call.

Parameters:

  • report_id

    Valid Report Id

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

Returns:



106
107
108
109
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 106

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 Report Id Download a report using the reportId value. If you don&#39;t already know this value, you can obtain it using the Retrieve available reports call.

Parameters:

  • report_id

    Valid Report Id

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

Returns:



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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 117

def get_report_by_report_id_with_http_info(report_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: ReportsApi.get_report_by_report_id ...'
        rescue
            puts 'Cannot write to log'
        end
  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'] !~ Regexp.new(/[a-zA-Z0-9-_]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"organization_id\"]' when calling ReportsApi.get_report_by_report_id, must conform to the pattern /[a-zA-Z0-9-_]+/."
  #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)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  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
    begin
    raise
        @api_client.config.logger.debug "API called: ReportsApi#get_report_by_report_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

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

Retrieve Available Reports Retrieve a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report.

Parameters:

  • start_time

    Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z)

  • end_time

    Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z)

  • time_query_type

    Specify time you would like to search Valid values: - reportTimeFrame - executedTime

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

  • :report_mime_type (String)

    Valid Report Format Valid values: - application/xml - text/csv

  • :report_frequency (String)

    Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC

  • :report_name (String)

    Valid Report Name

  • :report_definition_id (Integer)

    Valid Report Definition Id

  • :report_status (String)

    Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA

Returns:



191
192
193
194
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 191

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 a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report.

Parameters:

  • start_time

    Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z)

  • end_time

    Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z)

  • time_query_type

    Specify time you would like to search Valid values: - reportTimeFrame - executedTime

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

    the optional parameters

Options Hash (opts):

  • :organization_id (String)

    Valid Organization Id

  • :report_mime_type (String)

    Valid Report Format Valid values: - application/xml - text/csv

  • :report_frequency (String)

    Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC

  • :report_name (String)

    Valid Report Name

  • :report_definition_id (Integer)

    Valid Report Definition Id

  • :report_status (String)

    Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA

Returns:



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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/cybersource_rest_client/api/reports_api.rb', line 209

def search_reports_with_http_info(start_time, end_time, time_query_type, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: ReportsApi.search_reports ...'
        rescue
            puts 'Cannot write to log'
        end
  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
  #if @api_client.config.client_side_validation && !opts[:'organization_id'].nil? && opts[:'organization_id'] !~ Regexp.new(/[a-zA-Z0-9-_]+/)
    #fail ArgumentError, "invalid value for 'opts[:\"organization_id\"]' when calling ReportsApi.search_reports, must conform to the pattern /[a-zA-Z0-9-_]+/."
  #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)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  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
    begin
    raise
        @api_client.config.logger.debug "API called: ReportsApi#search_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end