Class: WalmartApIs::UpdateShipmentStatusRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/update_shipment_status_request.rb

Overview

UpdateShipmentStatusRequest Model.

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(shipment_status:, order_lines:, status_date: SKIP, additional_properties: nil) ⇒ UpdateShipmentStatusRequest

Returns a new instance of UpdateShipmentStatusRequest.



50
51
52
53
54
55
56
57
58
59
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 50

def initialize(shipment_status:, order_lines:, status_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @shipment_status = shipment_status
  @status_date = status_date unless status_date == SKIP
  @order_lines = order_lines
  @additional_properties = additional_properties
end

Instance Attribute Details

#order_linesArray[UpdateShipmentStatusLine]

ISO-8601 timestamp at which the seller observed the status change. Optional — if omitted, FMS defaults to server time.

Returns:



27
28
29
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 27

def order_lines
  @order_lines
end

#shipment_statusShipmentStatus1

Non-terminal shipment-lifecycle state. Mirrors Amazon SP-API Orders v0 shipmentStatus. For terminal Delivered use the dedicated /deliver endpoint.

Returns:



17
18
19
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 17

def shipment_status
  @shipment_status
end

#status_dateDateTime

ISO-8601 timestamp at which the seller observed the status change. Optional — if omitted, FMS defaults to server time.

Returns:

  • (DateTime)


22
23
24
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 22

def status_date
  @status_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  shipment_status =
    hash.key?('shipmentStatus') ? hash['shipmentStatus'] : nil
  # Parameter is an array, so we need to iterate through it
  order_lines = nil
  unless hash['orderLines'].nil?
    order_lines = []
    hash['orderLines'].each do |structure|
      order_lines << (UpdateShipmentStatusLine.from_hash(structure) if structure)
    end
  end

  order_lines = nil unless hash.key?('orderLines')
  status_date = if hash.key?('statusDate')
                  (DateTimeHelper.from_rfc3339(hash['statusDate']) if hash['statusDate'])
                else
                  SKIP
                end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UpdateShipmentStatusRequest.new(shipment_status: shipment_status,
                                  order_lines: order_lines,
                                  status_date: status_date,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['shipment_status'] = 'shipmentStatus'
  @_hash['status_date'] = 'statusDate'
  @_hash['order_lines'] = 'orderLines'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 39

def self.optionals
  %w[
    status_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} shipment_status: #{@shipment_status.inspect}, status_date:"\
  " #{@status_date.inspect}, order_lines: #{@order_lines.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_status_dateObject



98
99
100
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 98

def to_custom_status_date
  DateTimeHelper.to_rfc3339(status_date)
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/walmart_ap_is/models/update_shipment_status_request.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} shipment_status: #{@shipment_status}, status_date: #{@status_date},"\
  " order_lines: #{@order_lines}, additional_properties: #{@additional_properties}>"
end