Class: SyncteraRubySdk::BasePerson

Inherits:
Object
  • Object
show all
Defined in:
lib/synctera_ruby_sdk/models/base_person.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BasePerson

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 155

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SyncteraRubySdk::BasePerson` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `SyncteraRubySdk::BasePerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'ban_status')
    self.ban_status = attributes[:'ban_status']
  end

  if attributes.key?(:'creation_time')
    self.creation_time = attributes[:'creation_time']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'has_accounts')
    self.has_accounts = attributes[:'has_accounts']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'kyc_exempt')
    self.kyc_exempt = attributes[:'kyc_exempt']
  end

  if attributes.key?(:'kyc_last_run')
    self.kyc_last_run = attributes[:'kyc_last_run']
  end

  if attributes.key?(:'kyc_status')
    self.kyc_status = attributes[:'kyc_status']
  end

  if attributes.key?(:'last_updated_time')
    self.last_updated_time = attributes[:'last_updated_time']
  end

  if attributes.key?(:'legal_address')
    self.legal_address = attributes[:'legal_address']
  end

  if attributes.key?(:'metadata')
    self. = attributes[:'metadata']
  end

  if attributes.key?(:'middle_name')
    self.middle_name = attributes[:'middle_name']
  end

  if attributes.key?(:'note')
    self.note = attributes[:'note']
  end

  if attributes.key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.key?(:'related_customers')
    if (value = attributes[:'related_customers']).is_a?(Array)
      self.related_customers = value
    end
  end

  if attributes.key?(:'shipping_address')
    self.shipping_address = attributes[:'shipping_address']
  end

  if attributes.key?(:'ssn')
    self.ssn = attributes[:'ssn']
  end

  if attributes.key?(:'ssn_source')
    self.ssn_source = attributes[:'ssn_source']
  end

  if attributes.key?(:'tenant')
    self.tenant = attributes[:'tenant']
  end
end

Instance Attribute Details

#ban_statusObject

Returns the value of attribute ban_status.



18
19
20
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 18

def ban_status
  @ban_status
end

#creation_timeObject

The date and time the resource was created.



21
22
23
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 21

def creation_time
  @creation_time
end

#emailObject

Customer’s email



24
25
26
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 24

def email
  @email
end

#has_accountsObject

This flag indicates whether the person or business has accounts.



27
28
29
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 27

def has_accounts
  @has_accounts
end

#idObject

Customer unique identifier



30
31
32
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 30

def id
  @id
end

#kyc_exemptObject

Customer’s KYC exemption



33
34
35
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 33

def kyc_exempt
  @kyc_exempt
end

#kyc_last_runObject

Date and time KYC was last run on the customer



36
37
38
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 36

def kyc_last_run
  @kyc_last_run
end

#kyc_statusObject

Returns the value of attribute kyc_status.



38
39
40
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 38

def kyc_status
  @kyc_status
end

#last_updated_timeObject

The date and time the resource was last updated.



41
42
43
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 41

def last_updated_time
  @last_updated_time
end

Returns the value of attribute legal_address.



43
44
45
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 43

def legal_address
  @legal_address
end

#metadataObject

User-supplied metadata. Do not use to store PII.



46
47
48
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 46

def 
  @metadata
end

#middle_nameObject

Customer’s middle name



49
50
51
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 49

def middle_name
  @middle_name
end

#noteObject

Add an optional note when creating or updating a customer. A note is required when updating a customers’s ban_status between SUSPENDED and ALLOWED.



52
53
54
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 52

def note
  @note
end

#phone_numberObject

Customer’s mobile phone number with country code in E.164 format. Must have a valid country code. Area code and local phone number are not validated.



55
56
57
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 55

def phone_number
  @phone_number
end

Customer’s relationships with other accounts eg. guardian. This property is no longer supported. Setting it will return an error.



58
59
60
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 58

def related_customers
  @related_customers
end

#shipping_addressObject

Returns the value of attribute shipping_address.



60
61
62
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 60

def shipping_address
  @shipping_address
end

#ssnObject

Customer’s full tax ID eg SSN formatted with hyphens. This optional parameter is required when running KYC on a customer. Input must match the pattern ^\d3-\d2-\d4$. The response contains the last 4 digits only (e.g. 6789).



63
64
65
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 63

def ssn
  @ssn
end

#ssn_sourceObject

Returns the value of attribute ssn_source.



65
66
67
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 65

def ssn_source
  @ssn_source
end

#tenantObject

The id of the tenant containing the resource. This is relevant for Fintechs that have multiple workspaces.



68
69
70
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 68

def tenant
  @tenant
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



118
119
120
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 118

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 93

def self.attribute_map
  {
    :'ban_status' => :'ban_status',
    :'creation_time' => :'creation_time',
    :'email' => :'email',
    :'has_accounts' => :'has_accounts',
    :'id' => :'id',
    :'kyc_exempt' => :'kyc_exempt',
    :'kyc_last_run' => :'kyc_last_run',
    :'kyc_status' => :'kyc_status',
    :'last_updated_time' => :'last_updated_time',
    :'legal_address' => :'legal_address',
    :'metadata' => :'metadata',
    :'middle_name' => :'middle_name',
    :'note' => :'note',
    :'phone_number' => :'phone_number',
    :'related_customers' => :'related_customers',
    :'shipping_address' => :'shipping_address',
    :'ssn' => :'ssn',
    :'ssn_source' => :'ssn_source',
    :'tenant' => :'tenant'
  }
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



318
319
320
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 318

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



148
149
150
151
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 148

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 123

def self.openapi_types
  {
    :'ban_status' => :'BanStatus',
    :'creation_time' => :'Time',
    :'email' => :'String',
    :'has_accounts' => :'Boolean',
    :'id' => :'String',
    :'kyc_exempt' => :'Boolean',
    :'kyc_last_run' => :'Time',
    :'kyc_status' => :'CustomerKycStatus',
    :'last_updated_time' => :'Time',
    :'legal_address' => :'LegalAddress',
    :'metadata' => :'Object',
    :'middle_name' => :'String',
    :'note' => :'String',
    :'phone_number' => :'String',
    :'related_customers' => :'Array<Relationship1>',
    :'shipping_address' => :'ShippingAddress',
    :'ssn' => :'String',
    :'ssn_source' => :'SsnSource',
    :'tenant' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 279

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      ban_status == o.ban_status &&
      creation_time == o.creation_time &&
      email == o.email &&
      has_accounts == o.has_accounts &&
      id == o.id &&
      kyc_exempt == o.kyc_exempt &&
      kyc_last_run == o.kyc_last_run &&
      kyc_status == o.kyc_status &&
      last_updated_time == o.last_updated_time &&
      legal_address == o.legal_address &&
       == o. &&
      middle_name == o.middle_name &&
      note == o.note &&
      phone_number == o.phone_number &&
      related_customers == o.related_customers &&
      shipping_address == o.shipping_address &&
      ssn == o.ssn &&
      ssn_source == o.ssn_source &&
      tenant == o.tenant
end

#_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



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
380
381
382
383
384
385
386
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 349

def _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 = SyncteraRubySdk.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
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



420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 420

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

#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



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 325

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


305
306
307
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 305

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



311
312
313
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 311

def hash
  [ban_status, creation_time, email, has_accounts, id, kyc_exempt, kyc_last_run, kyc_status, last_updated_time, legal_address, , middle_name, note, phone_number, related_customers, shipping_address, ssn, ssn_source, tenant].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



249
250
251
252
253
254
255
256
257
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 249

def list_invalid_properties
  invalid_properties = Array.new
  pattern = Regexp.new(/^\+[1-9]\d{1,14}$/)
  if !@phone_number.nil? && @phone_number !~ pattern
    invalid_properties.push("invalid value for \"phone_number\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



396
397
398
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 396

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



402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 402

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



390
391
392
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 390

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



261
262
263
264
# File 'lib/synctera_ruby_sdk/models/base_person.rb', line 261

def valid?
  return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+[1-9]\d{1,14}$/)
  true
end