Class: PaypalServerSdk::ShippingDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::ShippingDetails
- Defined in:
- lib/paypal_server_sdk/models/shipping_details.rb
Overview
The shipping details.
Instance Attribute Summary collapse
-
#address ⇒ Address
The portable international postal address.
-
#name ⇒ ShippingName
The name of the party.
-
#options ⇒ Array[ShippingOption]
An array of shipping options that the payee or merchant offers to the payer to ship or pick up their items.
-
#phone_number ⇒ PhoneNumberWithCountryCode
The phone number in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).
-
#type ⇒ FulfillmentType
A classification for the method of purchase fulfillment (e.g shipping, in-store pickup, etc).
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(name: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) ⇒ ShippingDetails
constructor
A new instance of ShippingDetails.
Methods inherited from BaseModel
Constructor Details
#initialize(name: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) ⇒ ShippingDetails
Returns a new instance of ShippingDetails.
68 69 70 71 72 73 74 75 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 68 def initialize(name: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) @name = name unless name == SKIP @phone_number = phone_number unless phone_number == SKIP @type = type unless type == SKIP @options = unless == SKIP @address = address unless address == SKIP end |
Instance Attribute Details
#address ⇒ Address
The portable international postal address. Maps to [AddressValidationMetadata](github.com/googlei18n/libaddressinput/ wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](www.w3.org/TR/html51/sec-forms.html#autofilling-form-co ntrols-the-autocomplete-attribute).
39 40 41 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 39 def address @address end |
#name ⇒ ShippingName
The name of the party.
14 15 16 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 14 def name @name end |
#options ⇒ Array[ShippingOption]
An array of shipping options that the payee or merchant offers to the payer to ship or pick up their items.
30 31 32 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 30 def @options end |
#phone_number ⇒ PhoneNumberWithCountryCode
The phone number in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).
19 20 21 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 19 def phone_number @phone_number end |
#type ⇒ FulfillmentType
A classification for the method of purchase fulfillment (e.g shipping, in-store pickup, etc). Either ‘type` or `options` may be present, but not both.
25 26 27 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 25 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 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 104 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = ShippingName.from_hash(hash['name']) if hash['name'] phone_number = PhoneNumberWithCountryCode.from_hash(hash['phone_number']) if hash['phone_number'] type = hash.key?('type') ? hash['type'] : SKIP # Parameter is an array, so we need to iterate through it = nil unless hash['options'].nil? = [] hash['options'].each do |structure| << (ShippingOption.from_hash(structure) if structure) end end = SKIP unless hash.key?('options') address = Address.from_hash(hash['address']) if hash['address'] # Create object from extracted values. ShippingDetails.new(name: name, phone_number: phone_number, type: type, options: , address: address) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['phone_number'] = 'phone_number' @_hash['type'] = 'type' @_hash['options'] = 'options' @_hash['address'] = 'address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
53 54 55 56 57 58 59 60 61 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 53 def self.optionals %w[ name phone_number type options address ] end |