Class: Checkbook::User

Inherits:
Object
  • Object
show all
Defined in:
lib/checkbook/models/user.rb,
lib/checkbook/api/user.rb

Overview

User field

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ User

Initializes the object

Parameters:

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

    Model attributes in the form of hash



101
102
103
# File 'lib/checkbook/models/user.rb', line 101

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/checkbook/api/user.rb', line 17

def api_client
  @api_client
end

#business_nameObject

Business name



20
21
22
# File 'lib/checkbook/models/user.rb', line 20

def business_name
  @business_name
end

#check_numberObject

Number to be used for the next payment



23
24
25
# File 'lib/checkbook/models/user.rb', line 23

def check_number
  @check_number
end

#dobObject

User’s date of birth



26
27
28
# File 'lib/checkbook/models/user.rb', line 26

def dob
  @dob
end

#first_nameObject

User first name



29
30
31
# File 'lib/checkbook/models/user.rb', line 29

def first_name
  @first_name
end

#invoice_numberObject

Number to be used for the next invoice



32
33
34
# File 'lib/checkbook/models/user.rb', line 32

def invoice_number
  @invoice_number
end

#last_nameObject

User last name



35
36
37
# File 'lib/checkbook/models/user.rb', line 35

def last_name
  @last_name
end

#passwordObject

User password



38
39
40
# File 'lib/checkbook/models/user.rb', line 38

def password
  @password
end

#phoneObject

Phone number



41
42
43
# File 'lib/checkbook/models/user.rb', line 41

def phone
  @phone
end

#ssnObject

Social security number



44
45
46
# File 'lib/checkbook/models/user.rb', line 44

def ssn
  @ssn
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/checkbook/models/user.rb', line 390

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = ::Checkbook.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



62
63
64
# File 'lib/checkbook/models/user.rb', line 62

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



67
68
69
# File 'lib/checkbook/models/user.rb', line 67

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/checkbook/models/user.rb', line 47

def self.attribute_map
  {
    :'business_name' => :'business_name',
    :'check_number' => :'check_number',
    :'dob' => :'dob',
    :'first_name' => :'first_name',
    :'invoice_number' => :'invoice_number',
    :'last_name' => :'last_name',
    :'password' => :'password',
    :'phone' => :'phone',
    :'ssn' => :'ssn'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/checkbook/models/user.rb', line 366

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/checkbook/models/user.rb', line 87

def self.openapi_nullable
  Set.new([
    :'business_name',
    :'check_number',
    :'first_name',
    :'invoice_number',
    :'last_name',
    :'password',
    :'ssn'
  ])
end

.openapi_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/checkbook/models/user.rb', line 72

def self.openapi_types
  {
    :'business_name' => :'String',
    :'check_number' => :'Integer',
    :'dob' => :'Date',
    :'first_name' => :'String',
    :'invoice_number' => :'Integer',
    :'last_name' => :'String',
    :'password' => :'String',
    :'phone' => :'String',
    :'ssn' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/checkbook/models/user.rb', line 337

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      business_name == o.business_name &&
      check_number == o.check_number &&
      dob == o.dob &&
      first_name == o.first_name &&
      invoice_number == o.invoice_number &&
      last_name == o.last_name &&
      password == o.password &&
      phone == o.phone &&
      ssn == o.ssn
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/checkbook/models/user.rb', line 461

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#delete_api_key(key_id, opts = {}) ⇒ nil

Delete API key for user Delete API key for user

Parameters:

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/checkbook/api/user.rb', line 27

def delete_api_key(key_id, opts = {})
  delete_api_key_with_http_info(key_id, opts)
  nil
end

#delete_api_key_with_http_info(key_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete API key for user Delete API key for user

Parameters:

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

    the optional parameters

Returns:

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

    nil, 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/checkbook/api/user.rb', line 37

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

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

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

#delete_user(id, opts = {}) ⇒ nil

Remove marketplace user Delete a marketplace user. > [!NOTE] > Tip > The id that gets passed in needs to be the Checkbook system generated ‘id`, not the `user_id`. > Users with active transactions may not be deleted.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


90
91
92
93
# File 'lib/checkbook/api/user.rb', line 90

def delete_user(id, opts = {})
  delete_user_with_http_info(id, opts)
  nil
end

#delete_user_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove marketplace user Delete a marketplace user. &gt; [!NOTE] &gt; Tip &gt; The id that gets passed in needs to be the Checkbook system generated &#x60;id&#x60;, not the &#x60;user_id&#x60;. &gt; Users with active transactions may not be deleted.

Parameters:

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

    the optional parameters

Returns:

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

    nil, 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
# File 'lib/checkbook/api/user.rb', line 100

def delete_user_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.delete_user ...'
  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 User.delete_user"
  end
  # resource path
  local_var_path = '/v3/user/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) 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]

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

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


353
354
355
# File 'lib/checkbook/models/user.rb', line 353

def eql?(o)
  self == o
end

#get_api_keys(opts = {}) ⇒ APIKeyListResponse

Get API keys for user Return the API keys for the user

Parameters:

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

    the optional parameters

Returns:



152
153
154
155
# File 'lib/checkbook/api/user.rb', line 152

def get_api_keys(opts = {})
  data, _status_code, _headers = get_api_keys_with_http_info(opts)
  data
end

#get_api_keys_with_http_info(opts = {}) ⇒ Array<(APIKeyListResponse, Integer, Hash)>

Get API keys for user Return the API keys for the user

Parameters:

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

    the optional parameters

Returns:

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

    APIKeyListResponse data, response status code and response headers



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
199
200
201
202
203
# File 'lib/checkbook/api/user.rb', line 161

def get_api_keys_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.get_api_keys ...'
  end
  # resource path
  local_var_path = '/v3/user/api_key'

  # 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] || 'APIKeyListResponse'

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

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

#get_user(opts = {}) ⇒ GetUserResponse

Get user details Get user information

Parameters:

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

    the optional parameters

Returns:



209
210
211
212
# File 'lib/checkbook/api/user.rb', line 209

def get_user(opts = {})
  data, _status_code, _headers = get_user_with_http_info(opts)
  data
end

#get_user_with_http_info(opts = {}) ⇒ Array<(GetUserResponse, Integer, Hash)>

Get user details Get user information

Parameters:

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

    the optional parameters

Returns:

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

    GetUserResponse data, response status code and response headers



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
257
258
259
260
# File 'lib/checkbook/api/user.rb', line 218

def get_user_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.get_user ...'
  end
  # resource path
  local_var_path = '/v3/user'

  # 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] || 'GetUserResponse'

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

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

#get_users(opts = {}) ⇒ UserQueryResponse

Get marketplace users Return the marketplace users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :q (String)

    Query

  • :sort (String)

    Sort

Returns:



270
271
272
273
# File 'lib/checkbook/api/user.rb', line 270

def get_users(opts = {})
  data, _status_code, _headers = get_users_with_http_info(opts)
  data
end

#get_users_with_http_info(opts = {}) ⇒ Array<(UserQueryResponse, Integer, Hash)>

Get marketplace users Return the marketplace users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :q (String)

    Query

  • :sort (String)

    Sort

Returns:

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

    UserQueryResponse data, response status code and response headers



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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/checkbook/api/user.rb', line 283

def get_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.get_users ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling User.get_users, must be greater than or equal to 1.'
  end

  allowable_values = [10, 25, 50, 100, 250]
  if @api_client.config.client_side_validation && opts[:'per_page'] && !allowable_values.include?(opts[:'per_page'])
    fail ArgumentError, "invalid value for \"per_page\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 180
    fail ArgumentError, 'invalid value for "opts[:"q"]" when calling User.get_users, the character length must be smaller than or equal to 180.'
  end

  allowable_values = ["+DATE", "-DATE", "+USER_ID", "-USER_ID"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v3/user/list'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # 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] || 'UserQueryResponse'

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

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

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



359
360
361
# File 'lib/checkbook/models/user.rb', line 359

def hash
  [business_name, check_number, dob, first_name, invoice_number, last_name, password, phone, ssn].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



154
155
156
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/checkbook/models/user.rb', line 154

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@business_name.nil? && @business_name.to_s.length > 180
    invalid_properties.push('invalid value for "business_name", the character length must be smaller than or equal to 180.')
  end

  if !@business_name.nil? && @business_name.to_s.length < 2
    invalid_properties.push('invalid value for "business_name", the character length must be greater than or equal to 2.')
  end

  if !@check_number.nil? && @check_number > 100000000
    invalid_properties.push('invalid value for "check_number", must be smaller than or equal to 100000000.')
  end

  if !@check_number.nil? && @check_number < 1
    invalid_properties.push('invalid value for "check_number", must be greater than or equal to 1.')
  end

  if !@first_name.nil? && @first_name.to_s.length > 80
    invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 80.')
  end

  if !@first_name.nil? && @first_name.to_s.length < 2
    invalid_properties.push('invalid value for "first_name", the character length must be greater than or equal to 2.')
  end

  if !@invoice_number.nil? && @invoice_number > 100000000
    invalid_properties.push('invalid value for "invoice_number", must be smaller than or equal to 100000000.')
  end

  if !@invoice_number.nil? && @invoice_number < 1
    invalid_properties.push('invalid value for "invoice_number", must be greater than or equal to 1.')
  end

  if !@last_name.nil? && @last_name.to_s.length > 80
    invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 80.')
  end

  if !@last_name.nil? && @last_name.to_s.length < 2
    invalid_properties.push('invalid value for "last_name", the character length must be greater than or equal to 2.')
  end

  if !@password.nil? && @password.to_s.length > 180
    invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 180.')
  end

  if !@password.nil? && @password.to_s.length < 6
    invalid_properties.push('invalid value for "password", the character length must be greater than or equal to 6.')
  end

  if !@ssn.nil? && @ssn.to_s.length > 9
    invalid_properties.push('invalid value for "ssn", the character length must be smaller than or equal to 9.')
  end

  if !@ssn.nil? && @ssn.to_s.length < 4
    invalid_properties.push('invalid value for "ssn", the character length must be greater than or equal to 4.')
  end

  invalid_properties
end

#new_api_key(new_api_key_request, opts = {}) ⇒ NewApiKeyResponse

Generate new API Key for user Generate new API keys for the user

Parameters:

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

    the optional parameters

Returns:



352
353
354
355
# File 'lib/checkbook/api/user.rb', line 352

def new_api_key(new_api_key_request, opts = {})
  data, _status_code, _headers = new_api_key_with_http_info(new_api_key_request, opts)
  data
end

#new_api_key_with_http_info(new_api_key_request, opts = {}) ⇒ Array<(NewApiKeyResponse, Integer, Hash)>

Generate new API Key for user Generate new API keys for the user

Parameters:

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

    the optional parameters

Returns:

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

    NewApiKeyResponse data, response status code and response headers



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/checkbook/api/user.rb', line 362

def new_api_key_with_http_info(new_api_key_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.new_api_key ...'
  end
  # verify the required parameter 'new_api_key_request' is set
  if @api_client.config.client_side_validation && new_api_key_request.nil?
    fail ArgumentError, "Missing the required parameter 'new_api_key_request' when calling User.new_api_key"
  end
  # resource path
  local_var_path = '/v3/user/api_key'

  # 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'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

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

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

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

#post_user(create_user_request, opts = {}) ⇒ CreateUserResponse

Create user Create a new marketplace user. > [!NOTE] > **Common Errors** > > - **‘403: FORBIDDEN`**: Please ensure you are using the Marketplace Owner’s keys. If the ‘403` error persists, it may indicate that marketplace is not enabled for your account or you do not have an active billing bank account onboarded. Contact support@checkbook.io for more details.

Parameters:

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

    the optional parameters

Returns:



420
421
422
423
# File 'lib/checkbook/api/user.rb', line 420

def post_user(create_user_request, opts = {})
  data, _status_code, _headers = post_user_with_http_info(create_user_request, opts)
  data
end

#post_user_signature(signature_request, opts = {}) ⇒ nil

Add signature for user Add signature

Parameters:

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

    the optional parameters

Returns:

  • (nil)


488
489
490
491
# File 'lib/checkbook/api/user.rb', line 488

def post_user_signature(signature_request, opts = {})
  post_user_signature_with_http_info(signature_request, opts)
  nil
end

#post_user_signature_with_http_info(signature_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Add signature for user Add signature

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/checkbook/api/user.rb', line 498

def post_user_signature_with_http_info(signature_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.post_user_signature ...'
  end
  # verify the required parameter 'signature_request' is set
  if @api_client.config.client_side_validation && signature_request.nil?
    fail ArgumentError, "Missing the required parameter 'signature_request' when calling User.post_user_signature"
  end
  # resource path
  local_var_path = '/v3/user/signature'

  # 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'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#post_user_with_http_info(create_user_request, opts = {}) ⇒ Array<(CreateUserResponse, Integer, Hash)>

Create user Create a new marketplace user. &gt; [!NOTE] &gt; **Common Errors** &gt; &gt; - **&#x60;403: FORBIDDEN&#x60;**: Please ensure you are using the Marketplace Owner&#39;s keys. If the &#x60;403&#x60; error persists, it may indicate that marketplace is not enabled for your account or you do not have an active billing bank account onboarded. Contact support@checkbook.io for more details.

Parameters:

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

    the optional parameters

Returns:

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

    CreateUserResponse data, response status code and response headers



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/checkbook/api/user.rb', line 430

def post_user_with_http_info(create_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.post_user ...'
  end
  # verify the required parameter 'create_user_request' is set
  if @api_client.config.client_side_validation && create_user_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_user_request' when calling User.post_user"
  end
  # resource path
  local_var_path = '/v3/user'

  # 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'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

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

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

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

#put_user(update_user_request, opts = {}) ⇒ nil

Update user Update existing user information. > [!NOTE] > Note > This endpoint is used for updating a user’s KYB/KYC information. Checkbook validates this information asynchronously.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


556
557
558
559
# File 'lib/checkbook/api/user.rb', line 556

def put_user(update_user_request, opts = {})
  put_user_with_http_info(update_user_request, opts)
  nil
end

#put_user_webhook(trigger_user_webhook_request, opts = {}) ⇒ nil

Update a sandbox user status Update a user’s status in the sandbox environment.

Parameters:

Returns:

  • (nil)


624
625
626
627
# File 'lib/checkbook/api/user.rb', line 624

def put_user_webhook(trigger_user_webhook_request, opts = {})
  put_user_webhook_with_http_info(trigger_user_webhook_request, opts)
  nil
end

#put_user_webhook_with_http_info(trigger_user_webhook_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update a sandbox user status Update a user&#39;s status in the sandbox environment.

Parameters:

Returns:

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

    nil, response status code and response headers



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/checkbook/api/user.rb', line 634

def put_user_webhook_with_http_info(trigger_user_webhook_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.put_user_webhook ...'
  end
  # verify the required parameter 'trigger_user_webhook_request' is set
  if @api_client.config.client_side_validation && trigger_user_webhook_request.nil?
    fail ArgumentError, "Missing the required parameter 'trigger_user_webhook_request' when calling User.put_user_webhook"
  end
  # resource path
  local_var_path = '/v3/user/webhook'

  # 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'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#put_user_with_http_info(update_user_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update user Update existing user information. &gt; [!NOTE] &gt; Note &gt; This endpoint is used for updating a user&#39;s KYB/KYC information. Checkbook validates this information asynchronously.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/checkbook/api/user.rb', line 566

def put_user_with_http_info(update_user_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: User.put_user ...'
  end
  # verify the required parameter 'update_user_request' is set
  if @api_client.config.client_side_validation && update_user_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_user_request' when calling User.put_user"
  end
  # resource path
  local_var_path = '/v3/user'

  # 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'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



437
438
439
# File 'lib/checkbook/models/user.rb', line 437

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/checkbook/models/user.rb', line 443

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



431
432
433
# File 'lib/checkbook/models/user.rb', line 431

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/checkbook/models/user.rb', line 218

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@business_name.nil? && @business_name.to_s.length > 180
  return false if !@business_name.nil? && @business_name.to_s.length < 2
  return false if !@check_number.nil? && @check_number > 100000000
  return false if !@check_number.nil? && @check_number < 1
  return false if !@first_name.nil? && @first_name.to_s.length > 80
  return false if !@first_name.nil? && @first_name.to_s.length < 2
  return false if !@invoice_number.nil? && @invoice_number > 100000000
  return false if !@invoice_number.nil? && @invoice_number < 1
  return false if !@last_name.nil? && @last_name.to_s.length > 80
  return false if !@last_name.nil? && @last_name.to_s.length < 2
  return false if !@password.nil? && @password.to_s.length > 180
  return false if !@password.nil? && @password.to_s.length < 6
  return false if !@ssn.nil? && @ssn.to_s.length > 9
  return false if !@ssn.nil? && @ssn.to_s.length < 4
  true
end