Class: Plaid::Address2
- Defined in:
- lib/plaid/models/address2.rb
Overview
Address2 Model.
Instance Attribute Summary collapse
-
#city ⇒ String
The full city name.
-
#country ⇒ String
The country of the address.
-
#line1 ⇒ String
Street address line 1.
-
#line2 ⇒ String
Street address line 2.
-
#postal_code ⇒ String
5 digit postal code.
-
#region ⇒ String
The region or state Example: ‘“NC”`.
-
#state_code ⇒ String
The region or state Example: ‘“NC”`.
-
#street ⇒ String
The listed street address.
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, street: SKIP, line1: SKIP, line2: SKIP, postal_code: SKIP, region: SKIP, state_code: SKIP, country: SKIP, additional_properties: nil) ⇒ Address2
constructor
A new instance of Address2.
-
#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, street: SKIP, line1: SKIP, line2: SKIP, postal_code: SKIP, region: SKIP, state_code: SKIP, country: SKIP, additional_properties: nil) ⇒ Address2
Returns a new instance of Address2.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/plaid/models/address2.rb', line 88 def initialize(city: SKIP, street: SKIP, line1: SKIP, line2: SKIP, postal_code: SKIP, region: SKIP, state_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 @street = street unless street == SKIP @line1 = line1 unless line1 == SKIP @line2 = line2 unless line2 == SKIP @postal_code = postal_code unless postal_code == SKIP @region = region unless region == SKIP @state_code = state_code unless state_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/plaid/models/address2.rb', line 14 def city @city end |
#country ⇒ String
The country of the address.
44 45 46 |
# File 'lib/plaid/models/address2.rb', line 44 def country @country end |
#line1 ⇒ String
Street address line 1.
22 23 24 |
# File 'lib/plaid/models/address2.rb', line 22 def line1 @line1 end |
#line2 ⇒ String
Street address line 2.
26 27 28 |
# File 'lib/plaid/models/address2.rb', line 26 def line2 @line2 end |
#postal_code ⇒ String
5 digit postal code.
30 31 32 |
# File 'lib/plaid/models/address2.rb', line 30 def postal_code @postal_code end |
#region ⇒ String
The region or state Example: ‘“NC”`
35 36 37 |
# File 'lib/plaid/models/address2.rb', line 35 def region @region end |
#state_code ⇒ String
The region or state Example: ‘“NC”`
40 41 42 |
# File 'lib/plaid/models/address2.rb', line 40 def state_code @state_code end |
#street ⇒ String
The listed street address.
18 19 20 |
# File 'lib/plaid/models/address2.rb', line 18 def street @street end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/plaid/models/address2.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. city = hash.key?('city') ? hash['city'] : SKIP street = hash.key?('street') ? hash['street'] : SKIP line1 = hash.key?('line1') ? hash['line1'] : SKIP line2 = hash.key?('line2') ? hash['line2'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP state_code = hash.key?('state_code') ? hash['state_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. Address2.new(city: city, street: street, line1: line1, line2: line2, postal_code: postal_code, region: region, state_code: state_code, country: country, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/plaid/models/address2.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['city'] = 'city' @_hash['street'] = 'street' @_hash['line1'] = 'line1' @_hash['line2'] = 'line2' @_hash['postal_code'] = 'postal_code' @_hash['region'] = 'region' @_hash['state_code'] = 'state_code' @_hash['country'] = 'country' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/plaid/models/address2.rb', line 75 def self.nullables %w[ city street line1 line2 postal_code region state_code country ] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/plaid/models/address2.rb', line 61 def self.optionals %w[ city street line1 line2 postal_code region state_code country ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
147 148 149 150 151 152 153 |
# File 'lib/plaid/models/address2.rb', line 147 def inspect class_name = self.class.name.split('::').last "<#{class_name} city: #{@city.inspect}, street: #{@street.inspect}, line1:"\ " #{@line1.inspect}, line2: #{@line2.inspect}, postal_code: #{@postal_code.inspect}, region:"\ " #{@region.inspect}, state_code: #{@state_code.inspect}, country: #{@country.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
139 140 141 142 143 144 |
# File 'lib/plaid/models/address2.rb', line 139 def to_s class_name = self.class.name.split('::').last "<#{class_name} city: #{@city}, street: #{@street}, line1: #{@line1}, line2: #{@line2},"\ " postal_code: #{@postal_code}, region: #{@region}, state_code: #{@state_code}, country:"\ " #{@country}, additional_properties: #{@additional_properties}>" end |