Class: SyncteraRubySdk::BusinessesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/synctera_ruby_sdk/api/businesses_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BusinessesApi

Returns a new instance of BusinessesApi.



19
20
21
# File 'lib/synctera_ruby_sdk/api/businesses_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/synctera_ruby_sdk/api/businesses_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_business(business, opts = {}) ⇒ Business

Create a business Create a business who may act as a customer or a related business. You can then verify the identity of this customer and associate them with other people and accounts.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    An idempotency key is an arbitrary unique value generated by client to detect subsequent retries of the same request. It is recommended that a UUID or a similar random identifier be used as an idempotency key. A different key must be used for each request, unless it is a retry.

Returns:



28
29
30
31
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 28

def create_business(business, opts = {})
  data, _status_code, _headers = create_business_with_http_info(business, opts)
  data
end

#create_business_with_http_info(business, opts = {}) ⇒ Array<(Business, Integer, Hash)>

Create a business Create a business who may act as a customer or a related business. You can then verify the identity of this customer and associate them with other people and accounts.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    An idempotency key is an arbitrary unique value generated by client to detect subsequent retries of the same request. It is recommended that a UUID or a similar random identifier be used as an idempotency key. A different key must be used for each request, unless it is a retry.

Returns:

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

    Business data, response status code and response headers



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
84
85
86
87
88
89
90
91
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 39

def create_business_with_http_info(business, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BusinessesApi.create_business ...'
  end
  # verify the required parameter 'business' is set
  if @api_client.config.client_side_validation && business.nil?
    fail ArgumentError, "Missing the required parameter 'business' when calling BusinessesApi.create_business"
  end
  # resource path
  local_var_path = '/businesses'

  # 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', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"BusinessesApi.create_business",
    :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: BusinessesApi#create_business\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_business(business_id, opts = {}) ⇒ Business

Get business Get business by ID.

Parameters:

  • business_id (String)

    Business&#39;s unique identifier.

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 98

def get_business(business_id, opts = {})
  data, _status_code, _headers = get_business_with_http_info(business_id, opts)
  data
end

#get_business_with_http_info(business_id, opts = {}) ⇒ Array<(Business, Integer, Hash)>

Get business Get business by ID.

Parameters:

  • business_id (String)

    Business&#39;s unique identifier.

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

    the optional parameters

Returns:

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

    Business data, response status code and response headers



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
149
150
151
152
153
154
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 108

def get_business_with_http_info(business_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BusinessesApi.get_business ...'
  end
  # verify the required parameter 'business_id' is set
  if @api_client.config.client_side_validation && business_id.nil?
    fail ArgumentError, "Missing the required parameter 'business_id' when calling BusinessesApi.get_business"
  end
  # resource path
  local_var_path = '/businesses/{business_id}'.sub('{' + 'business_id' + '}', CGI.escape(business_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', 'application/problem+json'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"BusinessesApi.get_business",
    :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: BusinessesApi#get_business\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_businesses(opts = {}) ⇒ BusinessList

List business Retrieves paginated list of businesses associated with the authorized requester.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<String>)

    Unique identifier for the business. Multiple IDs can be provided as a comma-separated list.

  • :entity_name (String)
  • :phone_number (String)
  • :status (String)
  • :is_customer (Boolean)

    If true, show only customers. If false, show non-customer parties.

  • :sort_by (Array<String>)

    Specifies the sort order for the returned businesses.

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :has_accounts (Boolean)

    Filter on resources that have an account(s)

Returns:



169
170
171
172
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 169

def list_businesses(opts = {})
  data, _status_code, _headers = list_businesses_with_http_info(opts)
  data
end

#list_businesses_with_http_info(opts = {}) ⇒ Array<(BusinessList, Integer, Hash)>

List business Retrieves paginated list of businesses associated with the authorized requester.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<String>)

    Unique identifier for the business. Multiple IDs can be provided as a comma-separated list.

  • :entity_name (String)
  • :phone_number (String)
  • :status (String)
  • :is_customer (Boolean)

    If true, show only customers. If false, show non-customer parties.

  • :sort_by (Array<String>)

    Specifies the sort order for the returned businesses.

  • :limit (Integer) — default: default to 100
  • :page_token (String)
  • :has_accounts (Boolean)

    Filter on resources that have an account(s)

Returns:

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

    BusinessList data, response status code and response headers



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
212
213
214
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
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 187

def list_businesses_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BusinessesApi.list_businesses ...'
  end
  allowable_values = ["PROSPECT", "ACTIVE", "FROZEN", "SANCTION", "DISSOLVED", "CANCELLED", "SUSPENDED", "MERGED", "INACTIVE", "CONVERTED"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["entity_name:asc", "entity_name:desc", "creation_time:asc", "creation_time:desc", "last_updated_time:asc", "last_updated_time:desc"]
  if @api_client.config.client_side_validation && opts[:'sort_by'] && !opts[:'sort_by'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"sort_by\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BusinessesApi.list_businesses, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/businesses'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :csv) if !opts[:'id'].nil?
  query_params[:'entity_name'] = opts[:'entity_name'] if !opts[:'entity_name'].nil?
  query_params[:'phone_number'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'is_customer'] = opts[:'is_customer'] if !opts[:'is_customer'].nil?
  query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :csv) if !opts[:'sort_by'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil?
  query_params[:'has_accounts'] = opts[:'has_accounts'] if !opts[:'has_accounts'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"BusinessesApi.list_businesses",
    :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: BusinessesApi#list_businesses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_business(business_id, patch_business, opts = {}) ⇒ Business

Patch business Update business by ID.

Parameters:

  • business_id (String)

    Business&#39;s unique identifier.

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    An idempotency key is an arbitrary unique value generated by client to detect subsequent retries of the same request. It is recommended that a UUID or a similar random identifier be used as an idempotency key. A different key must be used for each request, unless it is a retry.

Returns:



259
260
261
262
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 259

def update_business(business_id, patch_business, opts = {})
  data, _status_code, _headers = update_business_with_http_info(business_id, patch_business, opts)
  data
end

#update_business_with_http_info(business_id, patch_business, opts = {}) ⇒ Array<(Business, Integer, Hash)>

Patch business Update business by ID.

Parameters:

  • business_id (String)

    Business&#39;s unique identifier.

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

    the optional parameters

Options Hash (opts):

  • :idempotency_key (String)

    An idempotency key is an arbitrary unique value generated by client to detect subsequent retries of the same request. It is recommended that a UUID or a similar random identifier be used as an idempotency key. A different key must be used for each request, unless it is a retry.

Returns:

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

    Business data, response status code and response headers



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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/synctera_ruby_sdk/api/businesses_api.rb', line 271

def update_business_with_http_info(business_id, patch_business, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BusinessesApi.update_business ...'
  end
  # verify the required parameter 'business_id' is set
  if @api_client.config.client_side_validation && business_id.nil?
    fail ArgumentError, "Missing the required parameter 'business_id' when calling BusinessesApi.update_business"
  end
  # verify the required parameter 'patch_business' is set
  if @api_client.config.client_side_validation && patch_business.nil?
    fail ArgumentError, "Missing the required parameter 'patch_business' when calling BusinessesApi.update_business"
  end
  # resource path
  local_var_path = '/businesses/{business_id}'.sub('{' + 'business_id' + '}', CGI.escape(business_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', 'application/problem+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

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

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

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

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

  new_options = opts.merge(
    :operation => :"BusinessesApi.update_business",
    :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: BusinessesApi#update_business\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end