Class: CyberSourceMergedSpec::ReportsController

Inherits:
BaseController show all
Defined in:
lib/cyber_source_merged_spec/controllers/reports_controller.rb

Overview

ReportsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#create_report(create_adhoc_report_request, organization_id: nil) ⇒ ApiResponse

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](https://www.cybersource.com/developers/documentation/reporting_and_ reconciliation) parameter: Report subscription request payload Id

Parameters:

  • create_adhoc_report_request (CreateAdhocReportRequest)

    Required

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/controllers/reports_controller.rb', line 88

def create_report(create_adhoc_report_request,
                  organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/reporting/v3/reports',
                                 Server::DEFAULT)
               .body_param(new_parameter(create_adhoc_report_request)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             ReportingV3ReportsPost400ResponseException))
    .execute
end

#get_report_by_report_id(report_id, organization_id: nil) ⇒ ApiResponse

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. Id

Parameters:

  • report_id (String)

    Required parameter: Valid Report Id

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cyber_source_merged_spec/controllers/reports_controller.rb', line 115

def get_report_by_report_id(report_id,
                            organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reporting/v3/reports/{reportId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(report_id, key: 'reportId')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReportingV3ReportsIdGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             ReportingV3ReportsIdPost400ResponseException)
                .local_error('404',
                             'No Reports Found',
                             APIException))
    .execute
end

#search_reports(start_time, end_time, time_query_type, organization_id: nil, report_mime_type: nil, report_frequency: nil, report_name: nil, report_definition_id: nil, report_status: nil) ⇒ ApiResponse

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. in ISO 8601 format Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor 14) Example date format: - yyyy-MM-dd'T'HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z) ISO 8601 format Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor 14) Example date format: - yyyy-MM-dd'T'HH:mm:ss.SSSZ (e.g. 2018-01-01T00:00:00.000Z) like to search Valid values: - reportTimeFrame - executedTime Id Valid values: - application/xml - text/csv Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC Definition Id Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA

Parameters:

  • start_time (DateTime)

    Required parameter: Valid report Start Time

  • end_time (DateTime)

    Required parameter: Valid report End Time in

  • time_query_type (String)

    Required parameter: Specify time you would

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

  • report_mime_type (String) (defaults to: nil)

    Optional parameter: Valid Report Format

  • report_frequency (String) (defaults to: nil)

    Optional parameter: Valid Report

  • report_name (String) (defaults to: nil)

    Optional parameter: Valid Report Name

  • report_definition_id (Integer) (defaults to: nil)

    Optional parameter: Valid Report

  • report_status (String) (defaults to: nil)

    Optional parameter: Valid Report Status

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
76
# File 'lib/cyber_source_merged_spec/controllers/reports_controller.rb', line 39

def search_reports(start_time,
                   end_time,
                   time_query_type,
                   organization_id: nil,
                   report_mime_type: nil,
                   report_frequency: nil,
                   report_name: nil,
                   report_definition_id: nil,
                   report_status: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reporting/v3/reports',
                                 Server::DEFAULT)
               .query_param(new_parameter(start_time, key: 'startTime')
                             .is_required(true))
               .query_param(new_parameter(end_time, key: 'endTime')
                             .is_required(true))
               .query_param(new_parameter(time_query_type, key: 'timeQueryType')
                             .is_required(true))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .query_param(new_parameter(report_mime_type, key: 'reportMimeType'))
               .query_param(new_parameter(report_frequency, key: 'reportFrequency'))
               .query_param(new_parameter(report_name, key: 'reportName'))
               .query_param(new_parameter(report_definition_id, key: 'reportDefinitionId'))
               .query_param(new_parameter(report_status, key: 'reportStatus'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReportingV3ReportsGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             ReportingV3ReportsGet400ResponseException)
                .local_error('404',
                             'No Reports Found',
                             APIException))
    .execute
end