Class: PaypalServerSdk::OrderTrackerRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::OrderTrackerRequest
- Defined in:
- lib/paypal_server_sdk/models/order_tracker_request.rb
Overview
The tracking details of an order.
Instance Attribute Summary collapse
-
#capture_id ⇒ String
The PayPal capture ID.
-
#carrier ⇒ ShipmentCarrier
The carrier for the shipment.
-
#carrier_name_other ⇒ String
The name of the carrier for the shipment.
-
#items ⇒ Array[OrderTrackerItem]
An array of details of items in the shipment.
-
#notify_payer ⇒ TrueClass | FalseClass
If true, sends an email notification to the payer of the PayPal transaction.
-
#tracking_number ⇒ String
The tracking number for the shipment.
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(capture_id:, tracking_number: SKIP, carrier: SKIP, carrier_name_other: SKIP, notify_payer: false, items: SKIP) ⇒ OrderTrackerRequest
constructor
A new instance of OrderTrackerRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(capture_id:, tracking_number: SKIP, carrier: SKIP, carrier_name_other: SKIP, notify_payer: false, items: SKIP) ⇒ OrderTrackerRequest
Returns a new instance of OrderTrackerRequest.
74 75 76 77 78 79 80 81 82 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 74 def initialize(capture_id:, tracking_number: SKIP, carrier: SKIP, carrier_name_other: SKIP, notify_payer: false, items: SKIP) @tracking_number = tracking_number unless tracking_number == SKIP @carrier = carrier unless carrier == SKIP @carrier_name_other = carrier_name_other unless carrier_name_other == SKIP @capture_id = capture_id @notify_payer = notify_payer unless notify_payer == SKIP @items = items unless items == SKIP end |
Instance Attribute Details
#capture_id ⇒ String
The PayPal capture ID.
34 35 36 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 34 def capture_id @capture_id end |
#carrier ⇒ ShipmentCarrier
The carrier for the shipment. Some carriers have a global version as well as local subsidiaries. The subsidiaries are repeated over many countries and might also have an entry in the global list. Choose the carrier for your country. If the carrier is not available for your country, choose the global version of the carrier. If your carrier name is not in the list, set ‘carrier` to `OTHER` and set carrier name in `carrier_name_other`. For allowed values, see <a href=“/docs/tracking/reference/carriers/”>Carriers</a>.
25 26 27 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 25 def carrier @carrier end |
#carrier_name_other ⇒ String
The name of the carrier for the shipment. Provide this value only if the carrier parameter is OTHER. This property supports Unicode.
30 31 32 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 30 def carrier_name_other @carrier_name_other end |
#items ⇒ Array[OrderTrackerItem]
An array of details of items in the shipment.
44 45 46 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 44 def items @items end |
#notify_payer ⇒ TrueClass | FalseClass
If true, sends an email notification to the payer of the PayPal transaction. The email contains the tracking information that was uploaded through the API.
40 41 42 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 40 def notify_payer @notify_payer end |
#tracking_number ⇒ String
The tracking number for the shipment. This property supports Unicode.
14 15 16 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 14 def tracking_number @tracking_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 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 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. capture_id = hash.key?('capture_id') ? hash['capture_id'] : nil tracking_number = hash.key?('tracking_number') ? hash['tracking_number'] : SKIP carrier = hash.key?('carrier') ? hash['carrier'] : SKIP carrier_name_other = hash.key?('carrier_name_other') ? hash['carrier_name_other'] : SKIP notify_payer = hash['notify_payer'] ||= false # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (OrderTrackerItem.from_hash(structure) if structure) end end items = SKIP unless hash.key?('items') # Create object from extracted values. OrderTrackerRequest.new(capture_id: capture_id, tracking_number: tracking_number, carrier: carrier, carrier_name_other: carrier_name_other, notify_payer: notify_payer, items: items) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['tracking_number'] = 'tracking_number' @_hash['carrier'] = 'carrier' @_hash['carrier_name_other'] = 'carrier_name_other' @_hash['capture_id'] = 'capture_id' @_hash['notify_payer'] = 'notify_payer' @_hash['items'] = 'items' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 |
# File 'lib/paypal_server_sdk/models/order_tracker_request.rb', line 59 def self.optionals %w[ tracking_number carrier carrier_name_other notify_payer items ] end |