Class: PaypalServerSdk::ShippingWithTrackingDetails

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

Overview

The order shipping details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name: SKIP, phone_number: SKIP, type: SKIP, options: SKIP, address: SKIP, trackers: SKIP) ⇒ ShippingWithTrackingDetails

Returns a new instance of ShippingWithTrackingDetails.



74
75
76
77
78
79
80
81
82
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 74

def initialize(name: SKIP, phone_number: SKIP, type: SKIP, options: SKIP,
               address: SKIP, trackers: SKIP)
  @name = name unless name == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @type = type unless type == SKIP
  @options = options unless options == SKIP
  @address = address unless address == SKIP
  @trackers = trackers unless trackers == SKIP
end

Instance Attribute Details

#addressAddress

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).

Returns:



39
40
41
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 39

def address
  @address
end

#nameShippingName

The name of the party.

Returns:



14
15
16
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 14

def name
  @name
end

#optionsArray[ShippingOption]

An array of shipping options that the payee or merchant offers to the payer to ship or pick up their items.

Returns:



30
31
32
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 30

def options
  @options
end

#phone_numberPhoneNumberWithCountryCode

The phone number in its canonical international [E.164 numbering plan format](www.itu.int/rec/T-REC-E.164/en).



19
20
21
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 19

def phone_number
  @phone_number
end

#trackersArray[OrderTrackerResponse]

An array of trackers for a transaction.

Returns:



43
44
45
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 43

def trackers
  @trackers
end

#typeFulfillmentType

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.

Returns:



25
26
27
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 25

def type
  @type
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
115
116
117
118
119
120
121
122
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = ShippingName.from_hash(hash['name']) if hash['name']
  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
  options = nil
  unless hash['options'].nil?
    options = []
    hash['options'].each do |structure|
      options << (ShippingOption.from_hash(structure) if structure)
    end
  end

  options = SKIP unless hash.key?('options')
  address = Address.from_hash(hash['address']) if hash['address']
  # Parameter is an array, so we need to iterate through it
  trackers = nil
  unless hash['trackers'].nil?
    trackers = []
    hash['trackers'].each do |structure|
      trackers << (OrderTrackerResponse.from_hash(structure) if structure)
    end
  end

  trackers = SKIP unless hash.key?('trackers')

  # Create object from extracted values.
  ShippingWithTrackingDetails.new(name: name,
                                  phone_number: phone_number,
                                  type: type,
                                  options: options,
                                  address: address,
                                  trackers: trackers)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['phone_number'] = 'phone_number'
  @_hash['type'] = 'type'
  @_hash['options'] = 'options'
  @_hash['address'] = 'address'
  @_hash['trackers'] = 'trackers'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
66
67
# File 'lib/paypal_server_sdk/models/shipping_with_tracking_details.rb', line 58

def self.optionals
  %w[
    name
    phone_number
    type
    options
    address
    trackers
  ]
end