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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #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.



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

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. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


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

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. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


40
41
42
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 40

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.



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

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



67
68
69
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, items: #{@items.inspect},"\
  " links: #{@links.inspect}, create_time: #{@create_time.inspect}, update_time:"\
  " #{@update_time.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
# File 'lib/paypal_server_sdk/models/order_tracker_response.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, status: #{@status}, items: #{@items}, links: #{@links},"\
  " create_time: #{@create_time}, update_time: #{@update_time}>"
end