Class: PaypalServerSdk::OrderUpdateCallbackRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::OrderUpdateCallbackRequest
- Defined in:
- lib/paypal_server_sdk/models/order_update_callback_request.rb
Overview
Shipping Options Callback request. This will be implemented by the merchants.
Instance Attribute Summary collapse
-
#id ⇒ String
The ID of the order.
-
#purchase_units ⇒ Array[PurchaseUnitRequest]
An array of purchase units.
-
#shipping_address ⇒ OrderUpdateCallbackShippingAddress
The portable international postal address.
-
#shipping_option ⇒ OrderUpdateCallbackShippingOption
The options that the payee or merchant offers to the payer to ship or pick up their items.
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(shipping_address:, purchase_units:, id: SKIP, shipping_option: SKIP) ⇒ OrderUpdateCallbackRequest
constructor
A new instance of OrderUpdateCallbackRequest.
-
#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(shipping_address:, purchase_units:, id: SKIP, shipping_option: SKIP) ⇒ OrderUpdateCallbackRequest
Returns a new instance of OrderUpdateCallbackRequest.
61 62 63 64 65 66 67 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 61 def initialize(shipping_address:, purchase_units:, id: SKIP, shipping_option: SKIP) @id = id unless id == SKIP @shipping_address = shipping_address @shipping_option = shipping_option unless shipping_option == SKIP @purchase_units = purchase_units end |
Instance Attribute Details
#id ⇒ String
The ID of the order.
15 16 17 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 15 def id @id end |
#purchase_units ⇒ Array[PurchaseUnitRequest]
An array of purchase units. At present only 1 purchase_unit is supported. Each purchase unit establishes a contract between a payer and the payee. Each purchase unit represents either a full or partial order that the payer intends to purchase from the payee.
36 37 38 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 36 def purchase_units @purchase_units end |
#shipping_address ⇒ OrderUpdateCallbackShippingAddress
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).
24 25 26 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 24 def shipping_address @shipping_address end |
#shipping_option ⇒ OrderUpdateCallbackShippingOption
The options that the payee or merchant offers to the payer to ship or pick up their items.
29 30 31 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 29 def shipping_option @shipping_option end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. shipping_address = OrderUpdateCallbackShippingAddress.from_hash(hash['shipping_address']) if hash['shipping_address'] # Parameter is an array, so we need to iterate through it purchase_units = nil unless hash['purchase_units'].nil? purchase_units = [] hash['purchase_units'].each do |structure| purchase_units << (PurchaseUnitRequest.from_hash(structure) if structure) end end purchase_units = nil unless hash.key?('purchase_units') id = hash.key?('id') ? hash['id'] : SKIP shipping_option = OrderUpdateCallbackShippingOption.from_hash(hash['shipping_option']) if hash['shipping_option'] # Create object from extracted values. OrderUpdateCallbackRequest.new(shipping_address: shipping_address, purchase_units: purchase_units, id: id, shipping_option: shipping_option) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['shipping_address'] = 'shipping_address' @_hash['shipping_option'] = 'shipping_option' @_hash['purchase_units'] = 'purchase_units' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 49 def self.optionals %w[ id shipping_option ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, shipping_address: #{@shipping_address.inspect},"\ " shipping_option: #{@shipping_option.inspect}, purchase_units: #{@purchase_units.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 |
# File 'lib/paypal_server_sdk/models/order_update_callback_request.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, shipping_address: #{@shipping_address}, shipping_option:"\ " #{@shipping_option}, purchase_units: #{@purchase_units}>" end |