Class: PaypalServerSdk::OrderTrackerResponse

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

Overview

The tracking response on creation of tracker.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id: SKIP, status: SKIP, items: SKIP, links: SKIP, create_time: SKIP, update_time: SKIP) ⇒ OrderTrackerResponse

Returns a new instance of OrderTrackerResponse.



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

def initialize(id: SKIP, status: SKIP, items: SKIP, links: SKIP,
               create_time: SKIP, update_time: SKIP)
  @id = id unless id == SKIP
  @status = status unless status == SKIP
  @items = items unless items == SKIP
  @links = links unless links == SKIP
  @create_time = create_time unless create_time == SKIP
  @update_time = update_time unless update_time == SKIP
end

Instance Attribute Details

#create_timeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.<blockquote><strong>Note:</strong> The regular expression provides guidance but does not reject all invalid dates.</blockquote>

Returns:

  • (String)


34
35
36
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 34

def create_time
  @create_time
end

#idString

The tracker id.

Returns:

  • (String)


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

def id
  @id
end

#itemsArray[OrderTrackerItem]

An array of details of items in the shipment.

Returns:



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

def items
  @items
end

An array of request-related HATEOAS links.

Returns:



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

def links
  @links
end

#statusOrderTrackerStatus

The status of the item shipment.

Returns:



18
19
20
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 18

def status
  @status
end

#update_timeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional.<blockquote><strong>Note:</strong> The regular expression provides guidance but does not reject all invalid dates.</blockquote>

Returns:

  • (String)


42
43
44
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 42

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
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
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  # 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')
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (LinkDescription.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')
  create_time = hash.key?('create_time') ? hash['create_time'] : SKIP
  update_time = hash.key?('update_time') ? hash['update_time'] : SKIP

  # Create object from extracted values.
  OrderTrackerResponse.new(id: id,
                           status: status,
                           items: items,
                           links: links,
                           create_time: create_time,
                           update_time: update_time)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['items'] = 'items'
  @_hash['links'] = 'links'
  @_hash['create_time'] = 'create_time'
  @_hash['update_time'] = 'update_time'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    status
    items
    links
    create_time
    update_time
  ]
end