Class: CyberSource::OffersApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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



18
19
20
21
# File 'lib/cybersource_rest_client/api/offers_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/offers_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#get_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {}) ⇒ InlineResponse20016

Retrieve an Offer Retrieves an offer record from the system.



34
35
36
37
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 34

def get_offer(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {})
  data, status_code, headers = get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts)
  return data, status_code, headers
end

#get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {}) ⇒ Array<(InlineResponse20016, Fixnum, Hash)>

Retrieve an Offer Retrieves an offer record from the system.



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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cybersource_rest_client/api/offers_api.rb', line 49

def get_offer_with_http_info(content_type, x_requestid, v_c_merchant_id, v_c_correlation_id, v_c_organization_id, id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: OffersApi.get_offer ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'content_type' is set

  if @api_client.config.client_side_validation && content_type.nil?
    fail ArgumentError, "Missing the required parameter 'content_type' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'x_requestid' is set

  if @api_client.config.client_side_validation && x_requestid.nil?
    fail ArgumentError, "Missing the required parameter 'x_requestid' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_merchant_id' is set

  if @api_client.config.client_side_validation && v_c_merchant_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_merchant_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_correlation_id' is set

  if @api_client.config.client_side_validation && v_c_correlation_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_correlation_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'v_c_organization_id' is set

  if @api_client.config.client_side_validation && v_c_organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'v_c_organization_id' when calling OffersApi.get_offer"
  end
  # verify the required parameter 'id' is set

  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling OffersApi.get_offer"
  end
  # resource path

  local_var_path = 'vas/v1/currencyconversion/{id}'.sub('{' + 'id' + '}', 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/hal+json;charset=utf-8'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
  header_params[:'Content-Type'] = content_type
  header_params[:'x-requestid'] = x_requestid
  header_params[:'v-c-merchant-id'] = v_c_merchant_id
  header_params[:'v-c-correlation-id'] = v_c_correlation_id
  header_params[:'v-c-organization-id'] = v_c_organization_id

  # 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_offer","get_offer_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end

  is_response_mle_for_api = MLEUtility.check_is_response_mle_for_api(@api_client.merchantconfig, ["get_offer","get_offer_with_http_info"])

  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 => 'InlineResponse20016',
    :isResponseMLEForApi => is_response_mle_for_api)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: OffersApi#get_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end