Class: PaypalServerSdk::OrderUpdateCallbackShippingOption

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb

Overview

The options that the payee or merchant offers to the payer to ship or pick up their items.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id:, label:, type: SKIP, amount: SKIP) ⇒ OrderUpdateCallbackShippingOption

Returns a new instance of OrderUpdateCallbackShippingOption.



56
57
58
59
60
61
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 56

def initialize(id:, label:, type: SKIP, amount: SKIP)
  @id = id
  @label = label
  @type = type unless type == SKIP
  @amount = amount unless amount == SKIP
end

Instance Attribute Details

#amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



31
32
33
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 31

def amount
  @amount
end

#idString

A unique ID that identifies a payer-selected shipping option.

Returns:

  • (String)


15
16
17
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 15

def id
  @id
end

#labelString

A description that the payer sees, which helps them choose an appropriate shipping option. For example, ‘Free Shipping`, `USPS Priority Shipping`, `Expédition prioritaire USPS`, or `USPS yōuxiān fā huò`. Localize this description to the payer’s locale.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 22

def label
  @label
end

#typeShippingType

A classification for the method of purchase fulfillment.

Returns:



26
27
28
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 26

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  label = hash.key?('label') ? hash['label'] : nil
  type = hash.key?('type') ? hash['type'] : SKIP
  amount = Money.from_hash(hash['amount']) if hash['amount']

  # Create object from extracted values.
  OrderUpdateCallbackShippingOption.new(id: id,
                                        label: label,
                                        type: type,
                                        amount: amount)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['label'] = 'label'
  @_hash['type'] = 'type'
  @_hash['amount'] = 'amount'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 44

def self.optionals
  %w[
    type
    amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 87

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, label: #{@label.inspect}, type: #{@type.inspect},"\
  " amount: #{@amount.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
# File 'lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb', line 81

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, label: #{@label}, type: #{@type}, amount: #{@amount}>"
end