Class: ThePlaidApi::ResponseBusinessAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::ResponseBusinessAddress
- Defined in:
- lib/the_plaid_api/models/response_business_address.rb
Overview
Physical address of a business. Used for response schemas.
Instance Attribute Summary collapse
-
#city ⇒ String
City from the address.
-
#country ⇒ String
Valid, capitalized, two-letter ISO code representing the country of this object.
-
#postal_code ⇒ String
The postal code for the associated address.
-
#region ⇒ String
A subdivision code.
-
#street ⇒ String
The primary street portion of an address.
-
#street2 ⇒ String
Extra street information, like an apartment or suite number.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(street:, street2:, city:, region:, postal_code:, country:, additional_properties: nil) ⇒ ResponseBusinessAddress
constructor
A new instance of ResponseBusinessAddress.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(street:, street2:, city:, region:, postal_code:, country:, additional_properties: nil) ⇒ ResponseBusinessAddress
Returns a new instance of ResponseBusinessAddress.
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 76 def initialize(street:, street2:, city:, region:, postal_code:, country:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @street = street @street2 = street2 @city = city @region = region @postal_code = postal_code @country = country @additional_properties = additional_properties end |
Instance Attribute Details
#city ⇒ String
City from the address. A string with at least one non-whitespace alphabetical character, with a max length of 100 characters.
27 28 29 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 27 def city @city end |
#country ⇒ String
Valid, capitalized, two-letter ISO code representing the country of this object. Must be in ISO 3166-1 alpha-2 form.
46 47 48 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 46 def country @country end |
#postal_code ⇒ String
The postal code for the associated address. Between 2 and 10 alphanumeric characters. For US-based addresses this must be 5 numeric digits.
41 42 43 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 41 def postal_code @postal_code end |
#region ⇒ String
A subdivision code. “Subdivision” is a generic term for “state”, “province”, “prefecture”, “zone”, etc. For the list of valid codes, see [country subdivision codes](plaid.com/documents/country_subdivision_codes.json). Country prefixes are omitted, since they are inferred from the ‘country` field.
36 37 38 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 36 def region @region end |
#street ⇒ String
The primary street portion of an address. If an address is provided, this field will always be filled. A string with at least one non-whitespace alphabetical character, with a max length of 80 characters.
16 17 18 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 16 def street @street end |
#street2 ⇒ String
Extra street information, like an apartment or suite number. If provided, a string with at least one non-whitespace character, with a max length of 50 characters.
22 23 24 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 22 def street2 @street2 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. street = hash.key?('street') ? hash['street'] : nil street2 = hash.key?('street2') ? hash['street2'] : nil city = hash.key?('city') ? hash['city'] : nil region = hash.key?('region') ? hash['region'] : nil postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil country = hash.key?('country') ? hash['country'] : 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. ResponseBusinessAddress.new(street: street, street2: street2, city: city, region: region, postal_code: postal_code, country: country, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['street'] = 'street' @_hash['street2'] = 'street2' @_hash['city'] = 'city' @_hash['region'] = 'region' @_hash['postal_code'] = 'postal_code' @_hash['country'] = 'country' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 69 70 71 72 73 74 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 66 def self.nullables %w[ street street2 city region postal_code ] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 61 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} street: #{@street.inspect}, street2: #{@street2.inspect}, city:"\ " #{@city.inspect}, region: #{@region.inspect}, postal_code: #{@postal_code.inspect},"\ " country: #{@country.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
120 121 122 123 124 125 |
# File 'lib/the_plaid_api/models/response_business_address.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} street: #{@street}, street2: #{@street2}, city: #{@city}, region:"\ " #{@region}, postal_code: #{@postal_code}, country: #{@country}, additional_properties:"\ " #{@additional_properties}>" end |