Class: FdxV660Api::DeliveryAddress1
- Defined in:
- lib/fdx_v660_api/models/delivery_address1.rb
Overview
Address of the payee who received the payment
Instance Attribute Summary collapse
-
#city ⇒ String
City.
-
#country ⇒ Iso3166CountryCode1
Country code.
-
#line1 ⇒ String
Address line 1.
-
#line2 ⇒ String
Address line 2.
-
#line3 ⇒ String
Address line 3.
-
#postal_code ⇒ String
Postal code.
-
#primary ⇒ TrueClass | FalseClass
Whether this is the primary and first address to use for contact.
-
#region ⇒ String
State, Province, Territory, Canton or Prefecture.
-
#type ⇒ DeliveryAddressType3
Type of address location.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(line1: SKIP, line2: SKIP, line3: SKIP, city: SKIP, region: SKIP, postal_code: SKIP, country: SKIP, type: SKIP, primary: SKIP, additional_properties: nil) ⇒ DeliveryAddress1
constructor
A new instance of DeliveryAddress1.
-
#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, line3: SKIP, city: SKIP, region: SKIP, postal_code: SKIP, country: SKIP, type: SKIP, primary: SKIP, additional_properties: nil) ⇒ DeliveryAddress1
Returns a new instance of DeliveryAddress1.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 90 def initialize(line1: SKIP, line2: SKIP, line3: SKIP, city: SKIP, region: SKIP, postal_code: SKIP, country: SKIP, type: SKIP, primary: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @line1 = line1 unless line1 == SKIP @line2 = line2 unless line2 == SKIP @line3 = line3 unless line3 == SKIP @city = city unless city == SKIP @region = region unless region == SKIP @postal_code = postal_code unless postal_code == SKIP @country = country unless country == SKIP @type = type unless type == SKIP @primary = primary unless primary == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#city ⇒ String
City
26 27 28 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 26 def city @city end |
#country ⇒ Iso3166CountryCode1
Country code
45 46 47 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 45 def country @country end |
#line1 ⇒ String
Address line 1
14 15 16 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 14 def line1 @line1 end |
#line2 ⇒ String
Address line 2
18 19 20 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 18 def line2 @line2 end |
#line3 ⇒ String
Address line 3
22 23 24 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 22 def line3 @line3 end |
#postal_code ⇒ String
Postal code
41 42 43 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 41 def postal_code @postal_code end |
#primary ⇒ TrueClass | FalseClass
Whether this is the primary and first address to use for contact
53 54 55 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 53 def primary @primary end |
#region ⇒ String
State, Province, Territory, Canton or Prefecture. From [Universal Postal
Union](https://www.upu.int/en/Postal-Solutions/Programmes-Services/Address
ing-Solutions#addressing-s42-standard) as of 2-26-2020, [S42 International
Address
Standards](https://www.upu.int/UPU/media/upu/documents/PostCode/S42_Intern
ational-Addressing-Standards.pdf). For U.S. addresses can be a 2-character
code from StateCode. For Canadian addresses can be a 2-character code
from ProvinceTerritoryCode
37 38 39 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 37 def region @region end |
#type ⇒ DeliveryAddressType3
Type of address location. One of BUSINESS, DELIVERY, HOME, MAILING
49 50 51 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 49 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 137 138 139 140 141 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 109 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 line3 = hash.key?('line3') ? hash['line3'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP primary = hash.key?('primary') ? hash['primary'] : 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. DeliveryAddress1.new(line1: line1, line2: line2, line3: line3, city: city, region: region, postal_code: postal_code, country: country, type: type, primary: primary, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 56 def self.names @_hash = {} if @_hash.nil? @_hash['line1'] = 'line1' @_hash['line2'] = 'line2' @_hash['line3'] = 'line3' @_hash['city'] = 'city' @_hash['region'] = 'region' @_hash['postal_code'] = 'postalCode' @_hash['country'] = 'country' @_hash['type'] = 'type' @_hash['primary'] = 'primary' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 86 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 71 def self.optionals %w[ line1 line2 line3 city region postal_code country type primary ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
145 146 147 148 149 150 151 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 145 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 162 def inspect class_name = self.class.name.split('::').last "<#{class_name} line1: #{@line1.inspect}, line2: #{@line2.inspect}, line3:"\ " #{@line3.inspect}, city: #{@city.inspect}, region: #{@region.inspect}, postal_code:"\ " #{@postal_code.inspect}, country: #{@country.inspect}, type: #{@type.inspect}, primary:"\ " #{@primary.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
154 155 156 157 158 159 |
# File 'lib/fdx_v660_api/models/delivery_address1.rb', line 154 def to_s class_name = self.class.name.split('::').last "<#{class_name} line1: #{@line1}, line2: #{@line2}, line3: #{@line3}, city: #{@city},"\ " region: #{@region}, postal_code: #{@postal_code}, country: #{@country}, type: #{@type},"\ " primary: #{@primary}, additional_properties: #{@additional_properties}>" end |