Class: MfkOpenapiRubyClient::CustomerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mfk_openapi_ruby_client/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/mfk_openapi_ruby_client/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/mfk_openapi_ruby_client/api/customer_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#assign_bank_transfer(customer_id, opts = {}) ⇒ BankTransfer

対象顧客1件に振込先口座番号を未割り当ての場合、割り当てます。振込先口座割り当て

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 27

def assign_bank_transfer(customer_id, opts = {})
  data, _status_code, _headers = assign_bank_transfer_with_http_info(customer_id, opts)
  data
end

#assign_bank_transfer_with_http_info(customer_id, opts = {}) ⇒ Array<(BankTransfer, Integer, Hash)>

対象顧客1件に振込先口座番号を未割り当ての場合、割り当てます。振込先口座割り当て

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

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

    the optional parameters

Returns:

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

    BankTransfer data, response status code and response headers



37
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
83
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 37

def assign_bank_transfer_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.assign_bank_transfer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.assign_bank_transfer"
  end
  # resource path
  local_var_path = '/customers/{customer_id}/bank_transfer'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"CustomerApi.assign_bank_transfer",
    :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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#assign_bank_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_customer(payload, opts = {}) ⇒ CreateCustomerResponse

顧客を登録することができます。顧客には必ず一つの請求先が必要であるため同時に請求先一件も登録します。顧客登録

Parameters:

  • payload (CustomerPayload)

    顧客登録情報です。請求先情報も含まれています。

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

    the optional parameters

Returns:



90
91
92
93
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 90

def create_customer(payload, opts = {})
  data, _status_code, _headers = create_customer_with_http_info(payload, opts)
  data
end

#create_customer_with_http_info(payload, opts = {}) ⇒ Array<(CreateCustomerResponse, Integer, Hash)>

顧客を登録することができます。顧客には必ず一つの請求先が必要であるため同時に請求先一件も登録します。顧客登録

Parameters:

  • payload (CustomerPayload)

    顧客登録情報です。請求先情報も含まれています。

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

    the optional parameters

Returns:

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

    CreateCustomerResponse data, response status code and response headers



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
141
142
143
144
145
146
147
148
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 100

def create_customer_with_http_info(payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer ...'
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling CustomerApi.create_customer"
  end
  # resource path
  local_var_path = '/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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"CustomerApi.create_customer",
    :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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#create_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_customer(customer_id, opts = {}) ⇒ Customer

顧客IDを指定して対象顧客1件を取得することができます。顧客取得

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

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

    the optional parameters

Returns:



155
156
157
158
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 155

def get_customer(customer_id, opts = {})
  data, _status_code, _headers = get_customer_with_http_info(customer_id, opts)
  data
end

#get_customer_with_http_info(customer_id, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

顧客IDを指定して対象顧客1件を取得することができます。顧客取得

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



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
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 165

def get_customer_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.get_customer"
  end
  # resource path
  local_var_path = '/customers/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"CustomerApi.get_customer",
    :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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#get_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_customers_list(opts = {}) ⇒ CustomersList

顧客の一覧を取得することができます。顧客番号や支払方法、未入金の有無で絞り込んで取得することもできます。顧客一覧取得

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    任意の顧客の &#x60;number&#x60;を指定します。該当する顧客がいる場合、その一件のみが返却されます。

  • :payment_method (Array<String>)

    支払方法を指定します。該当する支払方法の顧客が返却されます。指定できる値は &#x60;bank_transfer&#x60;(銀行振込), &#x60;account_transfer&#x60;(口座振替)の2種類のみです。支払方法は複数指定することができます。 複数指定する場合は&#x60;?payment_method&#x3D;bank_transfer&amp;payment_method&#x3D;account_transfer&#x60;のように指定してください。

  • :has_alert (Boolean)

    アラートの有無をboolean値で指定します。&#x60;true&#x60;の場合アラート有り、&#x60;false&#x60;の場合はアラート無しを表します。

  • :created_at_from (Time)

    指定された日時以降に作成された顧客を取得します。指定された日時に作成されたものも含まれます。 RFC3339の&#x60;date-time&#x60;(2019-04-01T10:36:43%2B09:00)で指定してください。

  • :created_at_to (Time)

    指定された日時以前に作成された顧客を取得します。指定された日時に作成されたものも含まれます。 RFC3339の&#x60;date-time&#x60;(2019-04-01T10:36:43%2B09:00)で指定してください。

  • :after (String)

    任意のリソースIDを指定します。追加日時の降順でこのIDのリソースよりも後のリソースを取得します。この時&#x60;after&#x60;で指定したIDのリソースは結果に含まれません。

  • :before (String)

    任意のリソースIDを指定します。追加日時の降順でこのIDのリソースよりも前のリソースを取得します。この時&#x60;before&#x60;で指定したIDのリソースは結果に含まれません。

  • :limit (Integer)

    取得したいリソースの最大件数を指定します。1~200の間の整数で指定してください。指定がない場合は20になります。

Returns:



225
226
227
228
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 225

def get_customers_list(opts = {})
  data, _status_code, _headers = get_customers_list_with_http_info(opts)
  data
end

#get_customers_list_with_http_info(opts = {}) ⇒ Array<(CustomersList, Integer, Hash)>

顧客の一覧を取得することができます。顧客番号や支払方法、未入金の有無で絞り込んで取得することもできます。顧客一覧取得

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    任意の顧客の &#x60;number&#x60;を指定します。該当する顧客がいる場合、その一件のみが返却されます。

  • :payment_method (Array<String>)

    支払方法を指定します。該当する支払方法の顧客が返却されます。指定できる値は &#x60;bank_transfer&#x60;(銀行振込), &#x60;account_transfer&#x60;(口座振替)の2種類のみです。支払方法は複数指定することができます。 複数指定する場合は&#x60;?payment_method&#x3D;bank_transfer&amp;payment_method&#x3D;account_transfer&#x60;のように指定してください。

  • :has_alert (Boolean)

    アラートの有無をboolean値で指定します。&#x60;true&#x60;の場合アラート有り、&#x60;false&#x60;の場合はアラート無しを表します。

  • :created_at_from (Time)

    指定された日時以降に作成された顧客を取得します。指定された日時に作成されたものも含まれます。 RFC3339の&#x60;date-time&#x60;(2019-04-01T10:36:43%2B09:00)で指定してください。

  • :created_at_to (Time)

    指定された日時以前に作成された顧客を取得します。指定された日時に作成されたものも含まれます。 RFC3339の&#x60;date-time&#x60;(2019-04-01T10:36:43%2B09:00)で指定してください。

  • :after (String)

    任意のリソースIDを指定します。追加日時の降順でこのIDのリソースよりも後のリソースを取得します。この時&#x60;after&#x60;で指定したIDのリソースは結果に含まれません。

  • :before (String)

    任意のリソースIDを指定します。追加日時の降順でこのIDのリソースよりも前のリソースを取得します。この時&#x60;before&#x60;で指定したIDのリソースは結果に含まれません。

  • :limit (Integer)

    取得したいリソースの最大件数を指定します。1~200の間の整数で指定してください。指定がない場合は20になります。

Returns:

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

    CustomersList data, response status code and response headers



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
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
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 242

def get_customers_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers_list ...'
  end
  if @api_client.config.client_side_validation && !opts[:'number'].nil? && opts[:'number'].to_s.length > 100
    fail ArgumentError, 'invalid value for "opts[:"number"]" when calling CustomerApi.get_customers_list, the character length must be smaller than or equal to 100.'
  end

  allowable_values = ["bank_transfer", "account_transfer"]
  if @api_client.config.client_side_validation && opts[:'payment_method'] && !opts[:'payment_method'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"payment_method\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomerApi.get_customers_list, must be smaller than or equal to 200.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CustomerApi.get_customers_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/customers'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'payment_method'] = @api_client.build_collection_param(opts[:'payment_method'], :csv) if !opts[:'payment_method'].nil?
  query_params[:'has_alert'] = opts[:'has_alert'] if !opts[:'has_alert'].nil?
  query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?
  query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CustomerApi.get_customers_list",
    :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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#get_customers_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_customer(customer_id, payload, opts = {}) ⇒ Customer

顧客の情報を更新することができます。顧客更新

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

  • payload (CustomerUpdatePayload)

    顧客更新情報です。

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

    the optional parameters

Returns:



316
317
318
319
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 316

def update_customer(customer_id, payload, opts = {})
  data, _status_code, _headers = update_customer_with_http_info(customer_id, payload, opts)
  data
end

#update_customer_with_http_info(customer_id, payload, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

顧客の情報を更新することができます。顧客更新

Parameters:

  • customer_id (String)

    対象の顧客IDを指定してください。

  • payload (CustomerUpdatePayload)

    顧客更新情報です。

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/mfk_openapi_ruby_client/api/customer_api.rb', line 327

def update_customer_with_http_info(customer_id, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.update_customer"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling CustomerApi.update_customer"
  end
  # resource path
  local_var_path = '/customers/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"CustomerApi.update_customer",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end