Class: ThePlaidApi::BusinessKybMatchDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/business_kyb_match_details.rb

Overview

Detailed information about the business from data provider results

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(names:, entity_type:, addresses:, phone_numbers:, email_addresses:, websites:, formation_date:, additional_properties: nil) ⇒ BusinessKybMatchDetails

Returns a new instance of BusinessKybMatchDetails.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 66

def initialize(names:, entity_type:, addresses:, phone_numbers:,
               email_addresses:, websites:, formation_date:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @names = names
  @entity_type = entity_type
  @addresses = addresses
  @phone_numbers = phone_numbers
  @email_addresses = email_addresses
  @websites = websites
  @formation_date = formation_date
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressesArray[ProviderBusinessAddress]

Addresses associated with the business

Returns:



22
23
24
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 22

def addresses
  @addresses
end

#email_addressesArray[BusinessEmailAddress]

Email addresses associated with the business

Returns:



30
31
32
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 30

def email_addresses
  @email_addresses
end

#entity_typeBusinessEntityType

The legal structure or type of business entity

Returns:



18
19
20
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 18

def entity_type
  @entity_type
end

#formation_dateDate

A date in the format YYYY-MM-DD (RFC 3339 Section 5.6).

Returns:

  • (Date)


38
39
40
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 38

def formation_date
  @formation_date
end

#namesArray[ProviderBusinessName]

Names associated with the business.

Returns:



14
15
16
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 14

def names
  @names
end

#phone_numbersArray[BusinessPhoneNumber]

Phone numbers associated with the business

Returns:



26
27
28
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 26

def phone_numbers
  @phone_numbers
end

#websitesArray[BusinessWebsite]

Websites associated with the business

Returns:



34
35
36
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 34

def websites
  @websites
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  names = nil
  unless hash['names'].nil?
    names = []
    hash['names'].each do |structure|
      names << (ProviderBusinessName.from_hash(structure) if structure)
    end
  end

  names = nil unless hash.key?('names')
  entity_type = hash.key?('entity_type') ? hash['entity_type'] : nil
  # Parameter is an array, so we need to iterate through it
  addresses = nil
  unless hash['addresses'].nil?
    addresses = []
    hash['addresses'].each do |structure|
      addresses << (ProviderBusinessAddress.from_hash(structure) if structure)
    end
  end

  addresses = nil unless hash.key?('addresses')
  # Parameter is an array, so we need to iterate through it
  phone_numbers = nil
  unless hash['phone_numbers'].nil?
    phone_numbers = []
    hash['phone_numbers'].each do |structure|
      phone_numbers << (BusinessPhoneNumber.from_hash(structure) if structure)
    end
  end

  phone_numbers = nil unless hash.key?('phone_numbers')
  # Parameter is an array, so we need to iterate through it
  email_addresses = nil
  unless hash['email_addresses'].nil?
    email_addresses = []
    hash['email_addresses'].each do |structure|
      email_addresses << (BusinessEmailAddress.from_hash(structure) if structure)
    end
  end

  email_addresses = nil unless hash.key?('email_addresses')
  # Parameter is an array, so we need to iterate through it
  websites = nil
  unless hash['websites'].nil?
    websites = []
    hash['websites'].each do |structure|
      websites << (BusinessWebsite.from_hash(structure) if structure)
    end
  end

  websites = nil unless hash.key?('websites')
  formation_date =
    hash.key?('formation_date') ? hash['formation_date'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  BusinessKybMatchDetails.new(names: names,
                              entity_type: entity_type,
                              addresses: addresses,
                              phone_numbers: phone_numbers,
                              email_addresses: email_addresses,
                              websites: websites,
                              formation_date: formation_date,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['names'] = 'names'
  @_hash['entity_type'] = 'entity_type'
  @_hash['addresses'] = 'addresses'
  @_hash['phone_numbers'] = 'phone_numbers'
  @_hash['email_addresses'] = 'email_addresses'
  @_hash['websites'] = 'websites'
  @_hash['formation_date'] = 'formation_date'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
62
63
64
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 59

def self.nullables
  %w[
    entity_type
    formation_date
  ]
end

.optionalsObject

An array for optional fields



54
55
56
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 54

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



169
170
171
172
173
174
175
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 169

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} names: #{@names.inspect}, entity_type: #{@entity_type.inspect}, addresses:"\
  " #{@addresses.inspect}, phone_numbers: #{@phone_numbers.inspect}, email_addresses:"\
  " #{@email_addresses.inspect}, websites: #{@websites.inspect}, formation_date:"\
  " #{@formation_date.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



160
161
162
163
164
165
166
# File 'lib/the_plaid_api/models/business_kyb_match_details.rb', line 160

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} names: #{@names}, entity_type: #{@entity_type}, addresses: #{@addresses},"\
  " phone_numbers: #{@phone_numbers}, email_addresses: #{@email_addresses}, websites:"\
  " #{@websites}, formation_date: #{@formation_date}, additional_properties:"\
  " #{@additional_properties}>"
end