class Trulioo::Result

Attributes

address[RW]
business_license_number[RW]
business_name[RW]
business_registration_number[RW]
business_status[RW]

Business Status

business_tax_id_number[RW]
business_type[RW]

Business Type

duns_number[RW]
email_address[RW]
full_address[RW]
index[RW]
jurisdiction_of_incorporation[RW]
matching_score[RW]
naics[RW]

North American Industry Classification System

other_business_names[RW]
sic[RW]

Standard Industrial Classification

tax_id_number[RW]
tax_id_numbers[RW]
telephone[RW]
trade_style_name[RW]

Trade Style Name

web_domain[RW]
web_domains[RW]
website[RW]

Public Class Methods

acceptable_attributes() click to toggle source

Returns all the JSON keys this model knows about

# File lib/trulioo_sdk/models/result.rb, line 95
def self.acceptable_attributes
  attribute_map.values
end
attribute_map() click to toggle source

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

# 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) click to toggle source

:nocov: Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/trulioo_sdk/models/result.rb, line 311
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/trulioo_sdk/models/result.rb, line 129
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# 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) click to toggle source

:nocov: Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# 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) click to toggle source

:nocov: Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# 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) click to toggle source

:nocov: Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/trulioo_sdk/models/result.rb, line 297
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# 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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/trulioo_sdk/models/result.rb, line 254
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

:nocov: to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/trulioo_sdk/models/result.rb, line 396
def to_body
  to_hash
end
to_hash() click to toggle source

:nocov: Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

:nocov: Returns the string representation of the object @return [String] String presentation of the object

# File lib/trulioo_sdk/models/result.rb, line 388
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/trulioo_sdk/models/result.rb, line 261
def valid?
  true
end