Class: WalmartApIs::FulfillmentOrder

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

Overview

FulfillmentOrder 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(seller_fulfillment_order_id:, displayable_order_id:, fulfillment_order_status:, marketplace_id: SKIP, displayable_order_date: SKIP, displayable_order_comment: SKIP, shipping_speed_category: SKIP, destination_address: SKIP, status_updated_at: SKIP, notification_emails: SKIP, additional_properties: nil) ⇒ FulfillmentOrder

Returns a new instance of FulfillmentOrder.



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
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 87

def initialize(seller_fulfillment_order_id:, displayable_order_id:,
               fulfillment_order_status:, marketplace_id: SKIP,
               displayable_order_date: SKIP,
               displayable_order_comment: SKIP,
               shipping_speed_category: SKIP, destination_address: SKIP,
               status_updated_at: SKIP, notification_emails: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @seller_fulfillment_order_id = seller_fulfillment_order_id
  @marketplace_id = marketplace_id unless marketplace_id == SKIP
  @displayable_order_id = displayable_order_id
  @displayable_order_date = displayable_order_date unless displayable_order_date == SKIP
  unless displayable_order_comment == SKIP
    @displayable_order_comment =
      displayable_order_comment
  end
  @shipping_speed_category = shipping_speed_category unless shipping_speed_category == SKIP
  @destination_address = destination_address unless destination_address == SKIP
  @fulfillment_order_status = fulfillment_order_status
  @status_updated_at = status_updated_at unless status_updated_at == SKIP
  @notification_emails = notification_emails unless notification_emails == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#destination_addressAddress

Order ID shown to the recipient

Returns:



39
40
41
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 39

def destination_address
  @destination_address
end

#displayable_order_commentString

Order ID shown to the recipient

Returns:

  • (String)


31
32
33
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 31

def displayable_order_comment
  @displayable_order_comment
end

#displayable_order_dateDateTime

Order ID shown to the recipient

Returns:

  • (DateTime)


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

def displayable_order_date
  @displayable_order_date
end

#displayable_order_idString

Order ID shown to the recipient

Returns:

  • (String)


23
24
25
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 23

def displayable_order_id
  @displayable_order_id
end

#fulfillment_order_statusFulfillmentOrderStatus

Order ID shown to the recipient



43
44
45
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 43

def fulfillment_order_status
  @fulfillment_order_status
end

#marketplace_idString

Seller-defined order ID

Returns:

  • (String)


19
20
21
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 19

def marketplace_id
  @marketplace_id
end

#notification_emailsArray[String]

Order ID shown to the recipient

Returns:

  • (Array[String])


51
52
53
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 51

def notification_emails
  @notification_emails
end

#seller_fulfillment_order_idString

Seller-defined order ID

Returns:

  • (String)


15
16
17
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 15

def seller_fulfillment_order_id
  @seller_fulfillment_order_id
end

#shipping_speed_categoryShippingSpeedCategory

Order ID shown to the recipient



35
36
37
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 35

def shipping_speed_category
  @shipping_speed_category
end

#status_updated_atDateTime

Order ID shown to the recipient

Returns:

  • (DateTime)


47
48
49
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 47

def status_updated_at
  @status_updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 114

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  seller_fulfillment_order_id =
    hash.key?('sellerFulfillmentOrderId') ? hash['sellerFulfillmentOrderId'] : nil
  displayable_order_id =
    hash.key?('displayableOrderId') ? hash['displayableOrderId'] : nil
  fulfillment_order_status =
    hash.key?('fulfillmentOrderStatus') ? hash['fulfillmentOrderStatus'] : nil
  marketplace_id = hash.key?('marketplaceId') ? hash['marketplaceId'] : SKIP
  displayable_order_date = if hash.key?('displayableOrderDate')
                             (DateTimeHelper.from_rfc3339(hash['displayableOrderDate']) if hash['displayableOrderDate'])
                           else
                             SKIP
                           end
  displayable_order_comment =
    hash.key?('displayableOrderComment') ? hash['displayableOrderComment'] : SKIP
  shipping_speed_category =
    hash.key?('shippingSpeedCategory') ? hash['shippingSpeedCategory'] : SKIP
  destination_address = Address.from_hash(hash['destinationAddress']) if
    hash['destinationAddress']
  status_updated_at = if hash.key?('statusUpdatedAt')
                        (DateTimeHelper.from_rfc3339(hash['statusUpdatedAt']) if hash['statusUpdatedAt'])
                      else
                        SKIP
                      end
  notification_emails =
    hash.key?('notificationEmails') ? hash['notificationEmails'] : SKIP

  # 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.
  FulfillmentOrder.new(seller_fulfillment_order_id: seller_fulfillment_order_id,
                       displayable_order_id: displayable_order_id,
                       fulfillment_order_status: fulfillment_order_status,
                       marketplace_id: marketplace_id,
                       displayable_order_date: displayable_order_date,
                       displayable_order_comment: displayable_order_comment,
                       shipping_speed_category: shipping_speed_category,
                       destination_address: destination_address,
                       status_updated_at: status_updated_at,
                       notification_emails: notification_emails,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['seller_fulfillment_order_id'] = 'sellerFulfillmentOrderId'
  @_hash['marketplace_id'] = 'marketplaceId'
  @_hash['displayable_order_id'] = 'displayableOrderId'
  @_hash['displayable_order_date'] = 'displayableOrderDate'
  @_hash['displayable_order_comment'] = 'displayableOrderComment'
  @_hash['shipping_speed_category'] = 'shippingSpeedCategory'
  @_hash['destination_address'] = 'destinationAddress'
  @_hash['fulfillment_order_status'] = 'fulfillmentOrderStatus'
  @_hash['status_updated_at'] = 'statusUpdatedAt'
  @_hash['notification_emails'] = 'notificationEmails'
  @_hash
end

.nullablesObject

An array for nullable fields



83
84
85
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 83

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 70

def self.optionals
  %w[
    marketplace_id
    displayable_order_date
    displayable_order_comment
    shipping_speed_category
    destination_address
    status_updated_at
    notification_emails
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 187

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_fulfillment_order_id: #{@seller_fulfillment_order_id.inspect},"\
  " marketplace_id: #{@marketplace_id.inspect}, displayable_order_id:"\
  " #{@displayable_order_id.inspect}, displayable_order_date:"\
  " #{@displayable_order_date.inspect}, displayable_order_comment:"\
  " #{@displayable_order_comment.inspect}, shipping_speed_category:"\
  " #{@shipping_speed_category.inspect}, destination_address: #{@destination_address.inspect},"\
  " fulfillment_order_status: #{@fulfillment_order_status.inspect}, status_updated_at:"\
  " #{@status_updated_at.inspect}, notification_emails: #{@notification_emails.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_displayable_order_dateObject



165
166
167
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 165

def to_custom_displayable_order_date
  DateTimeHelper.to_rfc3339(displayable_order_date)
end

#to_custom_status_updated_atObject



169
170
171
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 169

def to_custom_status_updated_at
  DateTimeHelper.to_rfc3339(status_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



174
175
176
177
178
179
180
181
182
183
184
# File 'lib/walmart_ap_is/models/fulfillment_order.rb', line 174

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_fulfillment_order_id: #{@seller_fulfillment_order_id},"\
  " marketplace_id: #{@marketplace_id}, displayable_order_id: #{@displayable_order_id},"\
  " displayable_order_date: #{@displayable_order_date}, displayable_order_comment:"\
  " #{@displayable_order_comment}, shipping_speed_category: #{@shipping_speed_category},"\
  " destination_address: #{@destination_address}, fulfillment_order_status:"\
  " #{@fulfillment_order_status}, status_updated_at: #{@status_updated_at},"\
  " notification_emails: #{@notification_emails}, additional_properties:"\
  " #{@additional_properties}>"
end