Class: Trulioo::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/trulioo_sdk/models/result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Result

Initializes the object

Parameters:

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

    Model attributes in the form of hash



136
137
138
139
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
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
246
247
248
249
250
# File 'lib/trulioo_sdk/models/result.rb', line 136

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#addressObject

Returns the value of attribute address.



41
42
43
# File 'lib/trulioo_sdk/models/result.rb', line 41

def address
  @address
end

#business_license_numberObject

Returns the value of attribute business_license_number.



26
27
28
# File 'lib/trulioo_sdk/models/result.rb', line 26

def business_license_number
  @business_license_number
end

#business_nameObject

Returns the value of attribute business_name.



16
17
18
# File 'lib/trulioo_sdk/models/result.rb', line 16

def business_name
  @business_name
end

#business_registration_numberObject

Returns the value of attribute business_registration_number.



20
21
22
# File 'lib/trulioo_sdk/models/result.rb', line 20

def business_registration_number
  @business_registration_number
end

#business_statusObject

Business Status



33
34
35
# File 'lib/trulioo_sdk/models/result.rb', line 33

def business_status
  @business_status
end

#business_tax_id_numberObject

Returns the value of attribute business_tax_id_number.



24
25
26
# File 'lib/trulioo_sdk/models/result.rb', line 24

def business_tax_id_number
  @business_tax_id_number
end

#business_typeObject

Business Type



39
40
41
# File 'lib/trulioo_sdk/models/result.rb', line 39

def business_type
  @business_type
end

#duns_numberObject

Returns the value of attribute duns_number.



22
23
24
# File 'lib/trulioo_sdk/models/result.rb', line 22

def duns_number
  @duns_number
end

#email_addressObject

Returns the value of attribute email_address.



53
54
55
# File 'lib/trulioo_sdk/models/result.rb', line 53

def email_address
  @email_address
end

#full_addressObject

Returns the value of attribute full_address.



30
31
32
# File 'lib/trulioo_sdk/models/result.rb', line 30

def full_address
  @full_address
end

#indexObject

Returns the value of attribute index.



14
15
16
# File 'lib/trulioo_sdk/models/result.rb', line 14

def index
  @index
end

#jurisdiction_of_incorporationObject

Returns the value of attribute jurisdiction_of_incorporation.



28
29
30
# File 'lib/trulioo_sdk/models/result.rb', line 28

def jurisdiction_of_incorporation
  @jurisdiction_of_incorporation
end

#matching_scoreObject

Returns the value of attribute matching_score.



18
19
20
# File 'lib/trulioo_sdk/models/result.rb', line 18

def matching_score
  @matching_score
end

#naicsObject

North American Industry Classification System



60
61
62
# File 'lib/trulioo_sdk/models/result.rb', line 60

def naics
  @naics
end

#other_business_namesObject

Returns the value of attribute other_business_names.



43
44
45
# File 'lib/trulioo_sdk/models/result.rb', line 43

def other_business_names
  @other_business_names
end

#sicObject

Standard Industrial Classification



63
64
65
# File 'lib/trulioo_sdk/models/result.rb', line 63

def sic
  @sic
end

#tax_id_numberObject

Returns the value of attribute tax_id_number.



49
50
51
# File 'lib/trulioo_sdk/models/result.rb', line 49

def tax_id_number
  @tax_id_number
end

#tax_id_numbersObject

Returns the value of attribute tax_id_numbers.



51
52
53
# File 'lib/trulioo_sdk/models/result.rb', line 51

def tax_id_numbers
  @tax_id_numbers
end

#telephoneObject

Returns the value of attribute telephone.



47
48
49
# File 'lib/trulioo_sdk/models/result.rb', line 47

def telephone
  @telephone
end

#trade_style_nameObject

Trade Style Name



36
37
38
# File 'lib/trulioo_sdk/models/result.rb', line 36

def trade_style_name
  @trade_style_name
end

#web_domainObject

Returns the value of attribute web_domain.



55
56
57
# File 'lib/trulioo_sdk/models/result.rb', line 55

def web_domain
  @web_domain
end

#web_domainsObject

Returns the value of attribute web_domains.



57
58
59
# File 'lib/trulioo_sdk/models/result.rb', line 57

def web_domains
  @web_domains
end

#websiteObject

Returns the value of attribute website.



45
46
47
# File 'lib/trulioo_sdk/models/result.rb', line 45

def website
  @website
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/trulioo_sdk/models/result.rb', line 95

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
92
# File 'lib/trulioo_sdk/models/result.rb', line 66

def self.attribute_map
  {
    :'index' => :'Index',
    :'business_name' => :'BusinessName',
    :'matching_score' => :'MatchingScore',
    :'business_registration_number' => :'BusinessRegistrationNumber',
    :'duns_number' => :'DUNSNumber',
    :'business_tax_id_number' => :'BusinessTaxIDNumber',
    :'business_license_number' => :'BusinessLicenseNumber',
    :'jurisdiction_of_incorporation' => :'JurisdictionOfIncorporation',
    :'full_address' => :'FullAddress',
    :'business_status' => :'BusinessStatus',
    :'trade_style_name' => :'TradeStyleName',
    :'business_type' => :'BusinessType',
    :'address' => :'Address',
    :'other_business_names' => :'OtherBusinessNames',
    :'website' => :'Website',
    :'telephone' => :'Telephone',
    :'tax_id_number' => :'TaxIDNumber',
    :'tax_id_numbers' => :'TaxIDNumbers',
    :'email_address' => :'EmailAddress',
    :'web_domain' => :'WebDomain',
    :'web_domains' => :'WebDomains',
    :'naics' => :'NAICS',
    :'sic' => :'SIC'
  }
end

.build_from_hash(attributes) ⇒ Object

:nocov: Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



311
312
313
# File 'lib/trulioo_sdk/models/result.rb', line 311

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

.openapi_nullableObject

List of attributes with nullable: true



129
130
131
132
# File 'lib/trulioo_sdk/models/result.rb', line 129

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/trulioo_sdk/models/result.rb', line 100

def self.openapi_types
  {
    :'index' => :'String',
    :'business_name' => :'String',
    :'matching_score' => :'String',
    :'business_registration_number' => :'String',
    :'duns_number' => :'String',
    :'business_tax_id_number' => :'String',
    :'business_license_number' => :'String',
    :'jurisdiction_of_incorporation' => :'String',
    :'full_address' => :'String',
    :'business_status' => :'String',
    :'trade_style_name' => :'String',
    :'business_type' => :'String',
    :'address' => :'Address',
    :'other_business_names' => :'Array<String>',
    :'website' => :'String',
    :'telephone' => :'String',
    :'tax_id_number' => :'String',
    :'tax_id_numbers' => :'Array<String>',
    :'email_address' => :'String',
    :'web_domain' => :'String',
    :'web_domains' => :'Array<String>',
    :'naics' => :'Array<BusinessSearchResponseIndustryCode>',
    :'sic' => :'Array<BusinessSearchResponseIndustryCode>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/trulioo_sdk/models/result.rb', line 267

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      index == o.index &&
      business_name == o.business_name &&
      matching_score == o.matching_score &&
      business_registration_number == o.business_registration_number &&
      duns_number == o.duns_number &&
      business_tax_id_number == o.business_tax_id_number &&
      business_license_number == o.business_license_number &&
      jurisdiction_of_incorporation == o.jurisdiction_of_incorporation &&
      full_address == o.full_address &&
      business_status == o.business_status &&
      trade_style_name == o.trade_style_name &&
      business_type == o.business_type &&
      address == o.address &&
      other_business_names == o.other_business_names &&
      website == o.website &&
      telephone == o.telephone &&
      tax_id_number == o.tax_id_number &&
      tax_id_numbers == o.tax_id_numbers &&
      email_address == o.email_address &&
      web_domain == o.web_domain &&
      web_domains == o.web_domains &&
      naics == o.naics &&
      sic == o.sic
end

#_deserialize(type, value) ⇒ Object

:nocov: Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/trulioo_sdk/models/result.rb', line 345

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

#_to_hash(value) ⇒ Hash

:nocov: 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



424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/trulioo_sdk/models/result.rb', line 424

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

:nocov: Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/trulioo_sdk/models/result.rb', line 320

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  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


297
298
299
# File 'lib/trulioo_sdk/models/result.rb', line 297

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



303
304
305
# File 'lib/trulioo_sdk/models/result.rb', line 303

def hash
  [index, business_name, matching_score, business_registration_number, duns_number, business_tax_id_number, business_license_number, jurisdiction_of_incorporation, full_address, business_status, trade_style_name, business_type, address, other_business_names, website, telephone, tax_id_number, tax_id_numbers, email_address, web_domain, web_domains, naics, sic].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



254
255
256
257
# File 'lib/trulioo_sdk/models/result.rb', line 254

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

:nocov: 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/trulioo_sdk/models/result.rb', line 396

def to_body
  to_hash
end

#to_hashHash

:nocov: Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/trulioo_sdk/models/result.rb', line 404

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

:nocov: Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



388
389
390
# File 'lib/trulioo_sdk/models/result.rb', line 388

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
# File 'lib/trulioo_sdk/models/result.rb', line 261

def valid?
  true
end