Class: CyberSourceMergedSpec::ReportSubscriptionsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb

Overview

ReportSubscriptionsController

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_standard_or_classic_subscription(predefined_subscription_request_bean, organization_id: nil) ⇒ ApiResponse

Create or update an already existing classic or standard subscription. predefined_subscription_request_bean Required parameter: Report subscription request payload Id

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb', line 130

def create_standard_or_classic_subscription(predefined_subscription_request_bean,
                                            organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/reporting/v3/predefined-report-subscriptions',
                                 Server::DEFAULT)
               .body_param(new_parameter(predefined_subscription_request_bean)
                            .is_required(true))
               .query_param(new_parameter(organization_id, key: 'organizationId'))
               .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
               .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',
                             CreateStandardOrClassicSubscriptionException))
    .execute
end

#create_subscription(create_report_subscription_request, organization_id: nil) ⇒ ApiResponse

Create a report subscription for your organization. The report name must be unique. create_report_subscription_request Required parameter: Report subscription request payload Id

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb', line 41

def create_subscription(create_report_subscription_request,
                        organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/reporting/v3/report-subscriptions',
                                 Server::DEFAULT)
               .body_param(new_parameter(create_report_subscription_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',
                             CreateSubscriptionException3Exception))
    .execute
end

#delete_subscription(report_name, organization_id: nil) ⇒ ApiResponse

Delete a report subscription for your organization. You must know the unique name of the report you want to delete. Delete Id

Parameters:

  • report_name (String)

    Required parameter: Name of the Report to

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb', line 100

def delete_subscription(report_name,
                        organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/reporting/v3/report-subscriptions/{reportName}',
                                 Server::DEFAULT)
               .template_param(new_parameter(report_name, key: 'reportName')
                                .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
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             ReportingV3ReportSubscriptionsNameDelete400ResponseException)
                .local_error('404',
                             'Subscription not found',
                             ReportingV3ReportSubscriptionsnameDelete404ResponseException))
    .execute
end

#get_all_subscriptions(organization_id: nil) ⇒ ApiResponse

View a summary of all report subscriptions. Id

Parameters:

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb', line 13

def get_all_subscriptions(organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reporting/v3/report-subscriptions',
                                 Server::DEFAULT)
               .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(ReportingV3ReportSubscriptionsGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             ReportingV3ReportSubscriptionsGet400ResponseException)
                .local_error('404',
                             'Subscriptions not found',
                             APIException))
    .execute
end

#get_subscription(report_name, organization_id: nil) ⇒ ApiResponse

View the details of a report subscription, such as the report format or report frequency, using the report’s unique name. Retrieve Id

Parameters:

  • report_name (String)

    Required parameter: Name of the Report to

  • organization_id (String) (defaults to: nil)

    Optional parameter: Valid Organization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cyber_source_merged_spec/controllers/report_subscriptions_controller.rb', line 69

def get_subscription(report_name,
                     organization_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/reporting/v3/report-subscriptions/{reportName}',
                                 Server::DEFAULT)
               .template_param(new_parameter(report_name, key: 'reportName')
                                .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(ReportingV3ReportsSubscriptionsNameGet200Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             ReportingV3ReportSubscriptionsNameGet400ResponseException)
                .local_error('404',
                             'Subscription not found',
                             APIException))
    .execute
end