Class: CyberSource::SubscriptionsFollowOnsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SubscriptionsFollowOnsApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb', line 18

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.



16
17
18
# File 'lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#create_follow_on_subscription(request_id, create_subscription_request, opts = {}) ⇒ CreateSubscriptionResponse

Create a Follow-On Subscription Create a new Subscription based on the Request Id of an existing successful Transaction.

Parameters:

  • request_id

    Request Id of an existing successful Transaction

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

    the optional parameters

Returns:



30
31
32
33
# File 'lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb', line 30

def create_follow_on_subscription(request_id, create_subscription_request, opts = {})
  data, status_code, headers = create_follow_on_subscription_with_http_info(request_id, create_subscription_request, opts)
  return data, status_code, headers
end

#create_follow_on_subscription_with_http_info(request_id, create_subscription_request, opts = {}) ⇒ Array<(CreateSubscriptionResponse, Fixnum, Hash)>

Create a Follow-On Subscription Create a new Subscription based on the Request Id of an existing successful Transaction.

Parameters:

  • request_id

    Request Id of an existing successful Transaction

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

    the optional parameters

Returns:

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

    CreateSubscriptionResponse data, response status code and response headers



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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb', line 41

def create_follow_on_subscription_with_http_info(request_id, create_subscription_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsFollowOnsApi.create_follow_on_subscription ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'request_id' is set
  if @api_client.config.client_side_validation && request_id.nil?
    fail ArgumentError, "Missing the required parameter 'request_id' when calling SubscriptionsFollowOnsApi.create_follow_on_subscription"
  end
  # verify the required parameter 'create_subscription_request' is set
  if @api_client.config.client_side_validation && create_subscription_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_subscription_request' when calling SubscriptionsFollowOnsApi.create_follow_on_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/follow-ons/{requestId}'.sub('{' + 'requestId' + '}', request_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/hal+json', 'application/json;charset=utf-8', 'application/hal+json;charset=utf-8'])
  # 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 = @api_client.object_to_http_body(create_subscription_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'CreateSubscriptionRequest1', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["create_follow_on_subscription","create_follow_on_subscription_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  end
  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,
    :return_type => 'CreateSubscriptionResponse')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsFollowOnsApi#create_follow_on_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_follow_on_subscription(request_id, opts = {}) ⇒ GetSubscriptionResponse1

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

Parameters:

  • request_id

    Request Id of an existing successful Transaction

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

    the optional parameters

Returns:



108
109
110
111
# File 'lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb', line 108

def get_follow_on_subscription(request_id, opts = {})
  data, status_code, headers = get_follow_on_subscription_with_http_info(request_id, opts)
  return data, status_code, headers
end

#get_follow_on_subscription_with_http_info(request_id, opts = {}) ⇒ Array<(GetSubscriptionResponse1, Fixnum, Hash)>

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

Parameters:

  • request_id

    Request Id of an existing successful Transaction

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

    the optional parameters

Returns:

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

    GetSubscriptionResponse1 data, response status code and response headers



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/subscriptions_follow_ons_api.rb', line 118

def get_follow_on_subscription_with_http_info(request_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: SubscriptionsFollowOnsApi.get_follow_on_subscription ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'request_id' is set
  if @api_client.config.client_side_validation && request_id.nil?
    fail ArgumentError, "Missing the required parameter 'request_id' when calling SubscriptionsFollowOnsApi.get_follow_on_subscription"
  end
  # resource path
  local_var_path = 'rbs/v1/subscriptions/follow-ons/{requestId}'.sub('{' + 'requestId' + '}', request_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/hal+json', 'application/json;charset=utf-8', 'application/hal+json;charset=utf-8'])
  # 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
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_follow_on_subscription","get_follow_on_subscription_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'GetSubscriptionResponse1')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: SubscriptionsFollowOnsApi#get_follow_on_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end