Class: Api::CustomerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/jamm/api/api/customer_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CustomerApi

Returns a new instance of CustomerApi.



19
20
21
# File 'lib/jamm/api/api/customer_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/jamm/api/api/customer_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create(body, opts = {}) ⇒ CreateCustomerResponse

Create customer Intended for pre-registering merchant customer into Jamm.

Parameters:

Returns:



28
29
30
31
# File 'lib/jamm/api/api/customer_api.rb', line 28

def create(body, opts = {})
  data, _status_code, _headers = create_with_http_info(body, opts)
  data
end

#create_with_http_info(body, opts = {}) ⇒ Array<(CreateCustomerResponse, Integer, Hash)>

Create customer Intended for pre-registering merchant customer into Jamm.

Parameters:

Returns:

  • (Array<(CreateCustomerResponse, Integer, Hash)>)

    CreateCustomerResponse data, response status code and response headers

Raises:

  • (ArgumentError)


38
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
77
78
79
80
81
82
# File 'lib/jamm/api/api/customer_api.rb', line 38

def create_with_http_info(body, opts = {})
  @api_client.config.logger.debug 'Calling API: CustomerApi.create ...' if @api_client.config.debugging
  # verify the required parameter 'body' is set
  raise ArgumentError, "Missing the required parameter 'body' when calling CustomerApi.create" if @api_client.config.client_side_validation && body.nil?

  # resource path
  local_var_path = '/v1/customers'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  header_params['Content-Type'] = content_type unless content_type.nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateCustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"CustomerApi.create",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  @api_client.config.logger.debug "API called: CustomerApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end

#delete(customer, opts = {}) ⇒ DeleteCustomerResponse

Delete customer Delete customer from Jamm.

Parameters:

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

    the optional parameters

Returns:



89
90
91
92
# File 'lib/jamm/api/api/customer_api.rb', line 89

def delete(customer, opts = {})
  data, _status_code, _headers = delete_with_http_info(customer, opts)
  data
end

#delete_with_http_info(customer, opts = {}) ⇒ Array<(DeleteCustomerResponse, Integer, Hash)>

Delete customer Delete customer from Jamm.

Parameters:

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

    the optional parameters

Returns:

  • (Array<(DeleteCustomerResponse, Integer, Hash)>)

    DeleteCustomerResponse data, response status code and response headers

Raises:

  • (ArgumentError)


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
140
# File 'lib/jamm/api/api/customer_api.rb', line 99

def delete_with_http_info(customer, opts = {})
  @api_client.config.logger.debug 'Calling API: CustomerApi.delete ...' if @api_client.config.debugging
  # verify the required parameter 'customer' is set
  raise ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.delete" if @api_client.config.client_side_validation && customer.nil?

  # resource path
  local_var_path = '/v1/customers/{customer}'.sub('{customer}', CGI.escape(customer.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteCustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"CustomerApi.delete",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  @api_client.config.logger.debug "API called: CustomerApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end

#get(customer, opts = {}) ⇒ GetCustomerResponse

Get customer Retrieve a merchant customer from Jamm. The merchant customer must be registered in Jamm.

Parameters:

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

    the optional parameters

Returns:



147
148
149
150
# File 'lib/jamm/api/api/customer_api.rb', line 147

def get(customer, opts = {})
  data, _status_code, _headers = get_with_http_info(customer, opts)
  data
end

#get_contract(customer, opts = {}) ⇒ GetContractResponse

Get a contract belongs to the customer Get a contract belongs to the customer

Parameters:

  • customer (String)

    @gotags: validate:&quot;required&quot;

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

    the optional parameters

Returns:



205
206
207
208
# File 'lib/jamm/api/api/customer_api.rb', line 205

def get_contract(customer, opts = {})
  data, _status_code, _headers = get_contract_with_http_info(customer, opts)
  data
end

#get_contract_with_http_info(customer, opts = {}) ⇒ Array<(GetContractResponse, Integer, Hash)>

Get a contract belongs to the customer Get a contract belongs to the customer

Parameters:

  • customer (String)

    @gotags: validate:&quot;required&quot;

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

    the optional parameters

Returns:

  • (Array<(GetContractResponse, Integer, Hash)>)

    GetContractResponse data, response status code and response headers

Raises:

  • (ArgumentError)


215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/jamm/api/api/customer_api.rb', line 215

def get_contract_with_http_info(customer, opts = {})
  @api_client.config.logger.debug 'Calling API: CustomerApi.get_contract ...' if @api_client.config.debugging
  # verify the required parameter 'customer' is set
  raise ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.get_contract" if @api_client.config.client_side_validation && customer.nil?

  # resource path
  local_var_path = '/v1/customers/{customer}/contract'.sub('{customer}', CGI.escape(customer.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetContractResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"CustomerApi.get_contract",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  @api_client.config.logger.debug "API called: CustomerApi#get_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end

#get_with_http_info(customer, opts = {}) ⇒ Array<(GetCustomerResponse, Integer, Hash)>

Get customer Retrieve a merchant customer from Jamm. The merchant customer must be registered in Jamm.

Parameters:

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

    the optional parameters

Returns:

  • (Array<(GetCustomerResponse, Integer, Hash)>)

    GetCustomerResponse data, response status code and response headers

Raises:

  • (ArgumentError)


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/jamm/api/api/customer_api.rb', line 157

def get_with_http_info(customer, opts = {})
  @api_client.config.logger.debug 'Calling API: CustomerApi.get ...' if @api_client.config.debugging
  # verify the required parameter 'customer' is set
  raise ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.get" if @api_client.config.client_side_validation && customer.nil?

  # resource path
  local_var_path = '/v1/customers/{customer}'.sub('{customer}', CGI.escape(customer.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetCustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"CustomerApi.get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  @api_client.config.logger.debug "API called: CustomerApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end

#update(customer, body, opts = {}) ⇒ UpdateCustomerResponse

Update customer Update customer metadata when they updated their information in merchant e-commerce store.

Parameters:

Returns:



264
265
266
267
# File 'lib/jamm/api/api/customer_api.rb', line 264

def update(customer, body, opts = {})
  data, _status_code, _headers = update_with_http_info(customer, body, opts)
  data
end

#update_with_http_info(customer, body, opts = {}) ⇒ Array<(UpdateCustomerResponse, Integer, Hash)>

Update customer Update customer metadata when they updated their information in merchant e-commerce store.

Parameters:

Returns:

  • (Array<(UpdateCustomerResponse, Integer, Hash)>)

    UpdateCustomerResponse data, response status code and response headers

Raises:

  • (ArgumentError)


275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/jamm/api/api/customer_api.rb', line 275

def update_with_http_info(customer, body, opts = {})
  @api_client.config.logger.debug 'Calling API: CustomerApi.update ...' if @api_client.config.debugging
  # verify the required parameter 'customer' is set
  raise ArgumentError, "Missing the required parameter 'customer' when calling CustomerApi.update" if @api_client.config.client_side_validation && customer.nil?
  # verify the required parameter 'body' is set
  raise ArgumentError, "Missing the required parameter 'body' when calling CustomerApi.update" if @api_client.config.client_side_validation && body.nil?

  # resource path
  local_var_path = '/v1/customers/{customer}'.sub('{customer}', CGI.escape(customer.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  header_params['Content-Type'] = content_type unless content_type.nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateCustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"CustomerApi.update",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  @api_client.config.logger.debug "API called: CustomerApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end