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.
-
#email_address ⇒ String
The internationalized email 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, email_address: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) ⇒ ShippingDetails
constructor
A new instance of ShippingDetails.
-
#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(name: SKIP, email_address: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) ⇒ ShippingDetails
Returns a new instance of ShippingDetails.
77 78 79 80 81 82 83 84 85 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 77 def initialize(name: SKIP, email_address: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP) @name = name unless name == SKIP @email_address = email_address unless email_address == 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).
46 47 48 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 46 def address @address end |
#email_address ⇒ String
The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
21 22 23 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 21 def email_address @email_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.
37 38 39 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 37 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).
26 27 28 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 26 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.
32 33 34 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 32 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = ShippingName.from_hash(hash['name']) if hash['name'] email_address = hash.key?('email_address') ? hash['email_address'] : SKIP 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, email_address: email_address, phone_number: phone_number, type: type, options: , address: address) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['email_address'] = 'email_address' @_hash['phone_number'] = 'phone_number' @_hash['type'] = 'type' @_hash['options'] = 'options' @_hash['address'] = 'address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 61 def self.optionals %w[ name email_address phone_number type options address ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 131 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, email_address: #{@email_address.inspect},"\ " phone_number: #{@phone_number.inspect}, type: #{@type.inspect}, options:"\ " #{@options.inspect}, address: #{@address.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 |
# File 'lib/paypal_server_sdk/models/shipping_details.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, email_address: #{@email_address}, phone_number:"\ " #{@phone_number}, type: #{@type}, options: #{@options}, address: #{@address}>" end |