Class: CyberSourceMergedSpec::SubscriptionsFollowOnsController

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

Overview

SubscriptionsFollowOnsController

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_follow_on_subscription(request_id, create_subscription_request) ⇒ ApiResponse

Create a new Subscription based on the Request Id of an existing successful Transaction. successful Transaction parameter: TODO: type description here

Parameters:

  • request_id (String)

    Required parameter: Request Id of an existing

  • create_subscription_request (CreateSubscriptionRequest1)

    Required

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/cyber_source_merged_spec/controllers/subscriptions_follow_ons_controller.rb', line 46

def create_follow_on_subscription(request_id,
                                  create_subscription_request)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/rbs/v1/subscriptions/follow-ons/{requestId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(request_id, key: 'requestId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(create_subscription_request)
                            .is_required(true))
               .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
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateSubscriptionResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             CreateFollowOnSubscriptionException)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             CreateFollowOnSubscriptionException2Exception))
    .execute
end

#get_follow_on_subscription(request_id) ⇒ ApiResponse

Get details of the Subscription being created based on the Request Id of an existing successful Transaction. successful Transaction

Parameters:

  • request_id (String)

    Required parameter: Request Id of an existing

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cyber_source_merged_spec/controllers/subscriptions_follow_ons_controller.rb', line 14

def get_follow_on_subscription(request_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/rbs/v1/subscriptions/follow-ons/{requestId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(request_id, key: 'requestId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetSubscriptionResponse1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request.',
                             GetFollowOnSubscriptionException)
                .local_error('404',
                             'Not found.',
                             GetFollowOnSubscriptionException2Exception)
                .local_error('502',
                             'Unexpected system error or system timeout.',
                             GetFollowOnSubscriptionException3Exception))
    .execute
end