Class: ThePlaidApi::BusinessSearchTerms

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

Overview

The business information that was used to perform the verification search

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(name:, alternative_names:, address:, website:, phone_number:, email_address:, additional_properties: nil) ⇒ BusinessSearchTerms

Returns a new instance of BusinessSearchTerms.



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

def initialize(name:, alternative_names:, address:, website:, phone_number:,
               email_address:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name
  @alternative_names = alternative_names
  @address = address
  @website = website
  @phone_number = phone_number
  @email_address = email_address
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressResponseBusinessAddress

Physical address of a business. Used for response schemas.



23
24
25
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 23

def address
  @address
end

#alternative_namesArray[String]

Alternative business names that were submitted as search inputs.

Returns:

  • (Array[String])


19
20
21
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 19

def alternative_names
  @alternative_names
end

#email_addressString

A valid email address. Must not have leading or trailing spaces and address must be RFC compliant. For more information, see [RFC 3696](datatracker.ietf.org/doc/html/rfc3696).

Returns:

  • (String)


37
38
39
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 37

def email_address
  @email_address
end

#nameString

The name of the business. Must have at least one character and a maximum length of 500 characters.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 15

def name
  @name
end

#phone_numberString

A phone number in E.164 format.

Returns:

  • (String)


31
32
33
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 31

def phone_number
  @phone_number
end

#websiteString

An ‘http’ or ‘https’ URL (must begin with either of those).

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 27

def website
  @website
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
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
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  alternative_names =
    hash.key?('alternative_names') ? hash['alternative_names'] : nil
  address = ResponseBusinessAddress.from_hash(hash['address']) if hash['address']
  website = hash.key?('website') ? hash['website'] : nil
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : nil
  email_address = hash.key?('email_address') ? hash['email_address'] : 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.
  BusinessSearchTerms.new(name: name,
                          alternative_names: alternative_names,
                          address: address,
                          website: website,
                          phone_number: phone_number,
                          email_address: email_address,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['alternative_names'] = 'alternative_names'
  @_hash['address'] = 'address'
  @_hash['website'] = 'website'
  @_hash['phone_number'] = 'phone_number'
  @_hash['email_address'] = 'email_address'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    name
    website
    phone_number
    email_address
  ]
end

.optionalsObject

An array for optional fields



52
53
54
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 52

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



119
120
121
122
123
124
125
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 119

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, alternative_names: #{@alternative_names.inspect},"\
  " address: #{@address.inspect}, website: #{@website.inspect}, phone_number:"\
  " #{@phone_number.inspect}, email_address: #{@email_address.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/the_plaid_api/models/business_search_terms.rb', line 111

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, alternative_names: #{@alternative_names}, address:"\
  " #{@address}, website: #{@website}, phone_number: #{@phone_number}, email_address:"\
  " #{@email_address}, additional_properties: #{@additional_properties}>"
end