Class: ModernTreasury::AddressRequest
- Defined in:
- lib/modern_treasury/models/address_request.rb
Overview
AddressRequest Model.
Instance Attribute Summary collapse
-
#country ⇒ String
Country code conforms to [ISO 3166-1 alpha-2].
-
#line1 ⇒ String
TODO: Write general description for this method.
-
#line2 ⇒ String
TODO: Write general description for this method.
-
#locality ⇒ String
Locality or City.
-
#postal_code ⇒ String
The postal code of the address.
-
#region ⇒ String
Region or State.
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(line1 = SKIP, line2 = SKIP, locality = SKIP, region = SKIP, postal_code = SKIP, country = SKIP) ⇒ AddressRequest
constructor
A new instance of AddressRequest.
-
#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(line1 = SKIP, line2 = SKIP, locality = SKIP, region = SKIP, postal_code = SKIP, country = SKIP) ⇒ AddressRequest
Returns a new instance of AddressRequest.
72 73 74 75 76 77 78 79 80 |
# File 'lib/modern_treasury/models/address_request.rb', line 72 def initialize(line1 = SKIP, line2 = SKIP, locality = SKIP, region = SKIP, postal_code = SKIP, country = SKIP) @line1 = line1 unless line1 == SKIP @line2 = line2 unless line2 == SKIP @locality = locality unless locality == SKIP @region = region unless region == SKIP @postal_code = postal_code unless postal_code == SKIP @country = country unless country == SKIP end |
Instance Attribute Details
#country ⇒ String
Country code conforms to [ISO 3166-1 alpha-2]
34 35 36 |
# File 'lib/modern_treasury/models/address_request.rb', line 34 def country @country end |
#line1 ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/modern_treasury/models/address_request.rb', line 14 def line1 @line1 end |
#line2 ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/modern_treasury/models/address_request.rb', line 18 def line2 @line2 end |
#locality ⇒ String
Locality or City.
22 23 24 |
# File 'lib/modern_treasury/models/address_request.rb', line 22 def locality @locality end |
#postal_code ⇒ String
The postal code of the address.
30 31 32 |
# File 'lib/modern_treasury/models/address_request.rb', line 30 def postal_code @postal_code end |
#region ⇒ String
Region or State.
26 27 28 |
# File 'lib/modern_treasury/models/address_request.rb', line 26 def region @region 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 |
# File 'lib/modern_treasury/models/address_request.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. line1 = hash.key?('line1') ? hash['line1'] : SKIP line2 = hash.key?('line2') ? hash['line2'] : SKIP locality = hash.key?('locality') ? hash['locality'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP # Create object from extracted values. AddressRequest.new(line1, line2, locality, region, postal_code, country) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/modern_treasury/models/address_request.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['line1'] = 'line1' @_hash['line2'] = 'line2' @_hash['locality'] = 'locality' @_hash['region'] = 'region' @_hash['postal_code'] = 'postal_code' @_hash['country'] = 'country' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/modern_treasury/models/address_request.rb', line 61 def self.nullables %w[ line1 line2 locality region postal_code country ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/modern_treasury/models/address_request.rb', line 49 def self.optionals %w[ line1 line2 locality region postal_code country ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/modern_treasury/models/address_request.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} line1: #{@line1.inspect}, line2: #{@line2.inspect}, locality:"\ " #{@locality.inspect}, region: #{@region.inspect}, postal_code: #{@postal_code.inspect},"\ " country: #{@country.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 |
# File 'lib/modern_treasury/models/address_request.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} line1: #{@line1}, line2: #{@line2}, locality: #{@locality}, region:"\ " #{@region}, postal_code: #{@postal_code}, country: #{@country}>" end |