Class: ThePlaidApi::AddressData2
- Defined in:
- lib/the_plaid_api/models/address_data2.rb
Overview
Data about the components comprising an address.
Instance Attribute Summary collapse
-
#city ⇒ String
The full city name.
-
#country ⇒ String
The ISO 3166-1 alpha-2 country code.
-
#postal_code ⇒ String
The postal code.
-
#region ⇒ String
The region or state Example: ‘“NC”`.
-
#street ⇒ String
The full street address Example: ‘“564 Main Street, APT 15”`.
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(city: SKIP, region: SKIP, street: SKIP, postal_code: SKIP, country: SKIP, additional_properties: nil) ⇒ AddressData2
constructor
A new instance of AddressData2.
-
#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(city: SKIP, region: SKIP, street: SKIP, postal_code: SKIP, country: SKIP, additional_properties: nil) ⇒ AddressData2
Returns a new instance of AddressData2.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 65 def initialize(city: SKIP, region: SKIP, street: SKIP, postal_code: SKIP, country: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @city = city unless city == SKIP @region = region unless region == SKIP @street = street unless street == SKIP @postal_code = postal_code unless postal_code == SKIP @country = country unless country == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#city ⇒ String
The full city name
14 15 16 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 14 def city @city end |
#country ⇒ String
The ISO 3166-1 alpha-2 country code
32 33 34 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 32 def country @country end |
#postal_code ⇒ String
The postal code
28 29 30 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 28 def postal_code @postal_code end |
#region ⇒ String
The region or state Example: ‘“NC”`
19 20 21 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 19 def region @region end |
#street ⇒ String
The full street address Example: ‘“564 Main Street, APT 15”`
24 25 26 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 24 def street @street end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. city = hash.key?('city') ? hash['city'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP street = hash.key?('street') ? hash['street'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP # 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. AddressData2.new(city: city, region: region, street: street, postal_code: postal_code, country: country, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['city'] = 'city' @_hash['region'] = 'region' @_hash['street'] = 'street' @_hash['postal_code'] = 'postal_code' @_hash['country'] = 'country' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 60 61 62 63 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 57 def self.nullables %w[ region postal_code country ] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 54 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 46 def self.optionals %w[ city region street postal_code country ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
113 114 115 116 117 118 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 113 def inspect class_name = self.class.name.split('::').last "<#{class_name} city: #{@city.inspect}, region: #{@region.inspect}, street:"\ " #{@street.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.
106 107 108 109 110 |
# File 'lib/the_plaid_api/models/address_data2.rb', line 106 def to_s class_name = self.class.name.split('::').last "<#{class_name} city: #{@city}, region: #{@region}, street: #{@street}, postal_code:"\ " #{@postal_code}, country: #{@country}, additional_properties: #{@additional_properties}>" end |