Class: PaypalServerSdk::AddressDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::AddressDetails
- Defined in:
- lib/paypal_server_sdk/models/address_details.rb
Overview
Address request details.
Instance Attribute Summary collapse
-
#address_line_1 ⇒ String
The first line of the address, such as number and street, for example, ‘173 Drury Lane`.
-
#address_line_2 ⇒ String
The second line of the address, for example, a suite or apartment number.
-
#admin_area_1 ⇒ String
The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision.
-
#admin_area_2 ⇒ String
A city, town, or village.
-
#company ⇒ String
The name of the company or business associated to the address.
-
#country_code ⇒ String
The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or region.<blockquote><strong>Note:</strong> The country code for Great Britain is
GB
and notUK
as used in the top-level domain names for that country. -
#id ⇒ String
The resource ID of the address.
-
#name ⇒ Name
The name of the party.
-
#phone ⇒ String
The phone number that can go on the mailing label with the address to track the shipping.
-
#phone_number ⇒ Phone
The phone number, in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).
-
#postal_code ⇒ String
The postal code, which is the ZIP code or equivalent.
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(country_code:, address_line_1: SKIP, address_line_2: SKIP, admin_area_2: SKIP, admin_area_1: SKIP, postal_code: SKIP, name: SKIP, id: SKIP, company: SKIP, phone: SKIP, phone_number: SKIP) ⇒ AddressDetails
constructor
A new instance of AddressDetails.
Methods inherited from BaseModel
Constructor Details
#initialize(country_code:, address_line_1: SKIP, address_line_2: SKIP, admin_area_2: SKIP, admin_area_1: SKIP, postal_code: SKIP, name: SKIP, id: SKIP, company: SKIP, phone: SKIP, phone_number: SKIP) ⇒ AddressDetails
Returns a new instance of AddressDetails.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 110 def initialize(country_code:, address_line_1: SKIP, address_line_2: SKIP, admin_area_2: SKIP, admin_area_1: SKIP, postal_code: SKIP, name: SKIP, id: SKIP, company: SKIP, phone: SKIP, phone_number: SKIP) @address_line_1 = address_line_1 unless address_line_1 == SKIP @address_line_2 = address_line_2 unless address_line_2 == SKIP @admin_area_2 = admin_area_2 unless admin_area_2 == SKIP @admin_area_1 = admin_area_1 unless admin_area_1 == SKIP @postal_code = postal_code unless postal_code == SKIP @country_code = country_code @name = name unless name == SKIP @id = id unless id == SKIP @company = company unless company == SKIP @phone = phone unless phone == SKIP @phone_number = phone_number unless phone_number == SKIP end |
Instance Attribute Details
#address_line_1 ⇒ String
The first line of the address, such as number and street, for example, ‘173 Drury Lane`. Needed for data entry, and Compliance and Risk checks. This field needs to pass the full address.
16 17 18 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 16 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ String
The second line of the address, for example, a suite or apartment number.
20 21 22 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 20 def address_line_2 @address_line_2 end |
#admin_area_1 ⇒ String
The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2 subdivision. This data is formatted for postal delivery, for example, ‘CA` and not `California`. Value, by country, is:<ul><li>UK. A county.</li><li>US. A state.</li><li>Canada. A province.</li><li>Japan. A prefecture.</li><li>Switzerland. A kanton.</li></ul>
33 34 35 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 33 def admin_area_1 @admin_area_1 end |
#admin_area_2 ⇒ String
A city, town, or village. Smaller than ‘admin_area_level_1`.
24 25 26 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 24 def admin_area_2 @admin_area_2 end |
#company ⇒ String
The name of the company or business associated to the address.
60 61 62 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 60 def company @company end |
#country_code ⇒ String
The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or region.<blockquote><strong>Note:</strong> The country code for Great Britain is GB
and not UK
as used in the top-level domain names for that country. Use the ‘C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.</blockquote>
48 49 50 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 48 def country_code @country_code end |
#id ⇒ String
The resource ID of the address.
56 57 58 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 56 def id @id end |
#name ⇒ Name
The name of the party.
52 53 54 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 52 def name @name end |
#phone ⇒ String
The phone number that can go on the mailing label with the address to track the shipping. Phone number is in E.164 format.
65 66 67 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 65 def phone @phone end |
#phone_number ⇒ Phone
The phone number, in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).
70 71 72 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 70 def phone_number @phone_number end |
#postal_code ⇒ String
The postal code, which is the ZIP code or equivalent. Typically required for countries with a postal code or an equivalent. See [postal code](en.wikipedia.org/wiki/Postal_code).
39 40 41 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 39 def postal_code @postal_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 128 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_code = hash.key?('country_code') ? hash['country_code'] : nil address_line_1 = hash.key?('address_line_1') ? hash['address_line_1'] : SKIP address_line_2 = hash.key?('address_line_2') ? hash['address_line_2'] : SKIP admin_area_2 = hash.key?('admin_area_2') ? hash['admin_area_2'] : SKIP admin_area_1 = hash.key?('admin_area_1') ? hash['admin_area_1'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP name = Name.from_hash(hash['name']) if hash['name'] id = hash.key?('id') ? hash['id'] : SKIP company = hash.key?('company') ? hash['company'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP phone_number = Phone.from_hash(hash['phone_number']) if hash['phone_number'] # Create object from extracted values. AddressDetails.new(country_code: country_code, address_line_1: address_line_1, address_line_2: address_line_2, admin_area_2: admin_area_2, admin_area_1: admin_area_1, postal_code: postal_code, name: name, id: id, company: company, phone: phone, phone_number: phone_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 73 def self.names @_hash = {} if @_hash.nil? @_hash['address_line_1'] = 'address_line_1' @_hash['address_line_2'] = 'address_line_2' @_hash['admin_area_2'] = 'admin_area_2' @_hash['admin_area_1'] = 'admin_area_1' @_hash['postal_code'] = 'postal_code' @_hash['country_code'] = 'country_code' @_hash['name'] = 'name' @_hash['id'] = 'id' @_hash['company'] = 'company' @_hash['phone'] = 'phone' @_hash['phone_number'] = 'phone_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
106 107 108 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 106 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/paypal_server_sdk/models/address_details.rb', line 90 def self.optionals %w[ address_line_1 address_line_2 admin_area_2 admin_area_1 postal_code name id company phone phone_number ] end |