Class: SyncteraRubySdk::Prospect

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

Overview

A prospect has a unique identifier. It can be upgrade to a customer with required information

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Prospect

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SyncteraRubySdk::Prospect` 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::Prospect`. 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?(:'dob')
    self.dob = attributes[:'dob']
  end

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

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

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

  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.



31
32
33
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 31

def ban_status
  @ban_status
end

#creation_timeObject

The date and time the resource was created.



34
35
36
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 34

def creation_time
  @creation_time
end

#dobObject

Customer’s date of birth in RFC 3339 full-date format (YYYY-MM-DD)



20
21
22
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 20

def dob
  @dob
end

#emailObject

Customer’s email



37
38
39
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 37

def email
  @email
end

#first_nameObject

Customer’s first name



23
24
25
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 23

def first_name
  @first_name
end

#has_accountsObject

This flag indicates whether the person or business has accounts.



40
41
42
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 40

def has_accounts
  @has_accounts
end

#idObject

Customer unique identifier



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

def id
  @id
end

#kyc_exemptObject

Customer’s KYC exemption



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

def kyc_exempt
  @kyc_exempt
end

#kyc_last_runObject

Date and time KYC was last run on the customer



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

def kyc_last_run
  @kyc_last_run
end

#kyc_statusObject

Returns the value of attribute kyc_status.



51
52
53
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 51

def kyc_status
  @kyc_status
end

#last_nameObject

Customer’s last name



26
27
28
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 26

def last_name
  @last_name
end

#last_updated_timeObject

The date and time the resource was last updated.



54
55
56
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 54

def last_updated_time
  @last_updated_time
end

Returns the value of attribute legal_address.



56
57
58
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 56

def legal_address
  @legal_address
end

#metadataObject

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



59
60
61
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 59

def 
  @metadata
end

#middle_nameObject

Customer’s middle name



62
63
64
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 62

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.



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

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.



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

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.



71
72
73
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 71

def related_customers
  @related_customers
end

#shipping_addressObject

Returns the value of attribute shipping_address.



73
74
75
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 73

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).



76
77
78
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 76

def ssn
  @ssn
end

#ssn_sourceObject

Returns the value of attribute ssn_source.



78
79
80
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 78

def ssn_source
  @ssn_source
end

#statusObject

Customer’s status



29
30
31
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 29

def status
  @status
end

#tenantObject

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



81
82
83
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 81

def tenant
  @tenant
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



135
136
137
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 135

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'dob' => :'dob',
    :'first_name' => :'first_name',
    :'last_name' => :'last_name',
    :'status' => :'status',
    :'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



384
385
386
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 384

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

.openapi_all_ofObject

List of class defined in allOf (OpenAPI v3)



175
176
177
178
179
180
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 175

def self.openapi_all_of
  [
  :'BasePerson',
  :'CustomerAllOf'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



169
170
171
172
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 169

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

.openapi_typesObject

Attribute type mapping.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 140

def self.openapi_types
  {
    :'dob' => :'Date',
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'status' => :'String',
    :'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



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      dob == o.dob &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      status == o.status &&
      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



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 415

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



486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 486

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



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 391

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


371
372
373
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 371

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



377
378
379
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 377

def hash
  [dob, first_name, last_name, status, 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



294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 294

def list_invalid_properties
  invalid_properties = Array.new
  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  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



462
463
464
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 462

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



468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 468

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



456
457
458
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 456

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



310
311
312
313
314
315
316
# File 'lib/synctera_ruby_sdk/models/prospect.rb', line 310

def valid?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ESCHEAT", "DECEASED", "DENIED", "DORMANT", "FROZEN", "INACTIVE", "PROSPECT", "SANCTION"])
  return false unless status_validator.valid?(@status)
  return false if !@phone_number.nil? && @phone_number !~ Regexp.new(/^\+[1-9]\d{1,14}$/)
  true
end