Class: PaypalServerSdk::ShippingInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::ShippingInformation
- Defined in:
- lib/paypal_server_sdk/models/shipping_information.rb
Overview
The shipping information.
Instance Attribute Summary collapse
-
#address ⇒ SimplePostalAddressCoarseGrained
A simple postal address with coarse-grained fields.
-
#method ⇒ String
The shipping method that is associated with this order.
-
#name ⇒ String
The recipient’s name.
-
#secondary_shipping_address ⇒ SimplePostalAddressCoarseGrained
A simple postal address with coarse-grained fields.
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, method: SKIP, address: SKIP, secondary_shipping_address: SKIP) ⇒ ShippingInformation
constructor
A new instance of ShippingInformation.
-
#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, method: SKIP, address: SKIP, secondary_shipping_address: SKIP) ⇒ ShippingInformation
Returns a new instance of ShippingInformation.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 57 def initialize(name: SKIP, method: SKIP, address: SKIP, secondary_shipping_address: SKIP) @name = name unless name == SKIP @method = method unless method == SKIP @address = address unless address == SKIP unless secondary_shipping_address == SKIP @secondary_shipping_address = secondary_shipping_address end end |
Instance Attribute Details
#address ⇒ SimplePostalAddressCoarseGrained
A simple postal address with coarse-grained fields. Do not use for an international address. Use for backward compatibility only. Does not contain phone.
24 25 26 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 24 def address @address end |
#method ⇒ String
The shipping method that is associated with this order.
18 19 20 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 18 def method @method end |
#name ⇒ String
The recipient’s name.
14 15 16 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 14 def name @name end |
#secondary_shipping_address ⇒ SimplePostalAddressCoarseGrained
A simple postal address with coarse-grained fields. Do not use for an international address. Use for backward compatibility only. Does not contain phone.
30 31 32 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 30 def secondary_shipping_address @secondary_shipping_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP method = hash.key?('method') ? hash['method'] : SKIP address = SimplePostalAddressCoarseGrained.from_hash(hash['address']) if hash['address'] if hash['secondary_shipping_address'] secondary_shipping_address = SimplePostalAddressCoarseGrained.from_hash(hash['secondary_shipping_address']) end # Create object from extracted values. ShippingInformation.new(name: name, method: method, address: address, secondary_shipping_address: secondary_shipping_address) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['method'] = 'method' @_hash['address'] = 'address' @_hash['secondary_shipping_address'] = 'secondary_shipping_address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 43 def self.optionals %w[ name method address secondary_shipping_address ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
95 96 97 98 99 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 95 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, method: #{@method.inspect}, address:"\ " #{@address.inspect}, secondary_shipping_address: #{@secondary_shipping_address.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
88 89 90 91 92 |
# File 'lib/paypal_server_sdk/models/shipping_information.rb', line 88 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, method: #{@method}, address: #{@address},"\ " secondary_shipping_address: #{@secondary_shipping_address}>" end |