Class: WalmartApIs::CreateFulfillmentOrderRequest

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

Overview

CreateFulfillmentOrderRequest 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:, displayable_order_date:, shipping_speed_category:, destination_address:, items:, marketplace_id: MarketplaceId::WALMART_US, displayable_order_comment: SKIP, notification_emails: SKIP, additional_properties: nil) ⇒ CreateFulfillmentOrderRequest

Returns a new instance of CreateFulfillmentOrderRequest.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 78

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

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

Instance Attribute Details

#destination_addressAddress

TODO: Write general description for this method

Returns:



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

def destination_address
  @destination_address
end

#displayable_order_commentString

TODO: Write general description for this method

Returns:

  • (String)


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

def displayable_order_comment
  @displayable_order_comment
end

#displayable_order_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def displayable_order_date
  @displayable_order_date
end

#displayable_order_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def displayable_order_id
  @displayable_order_id
end

#itemsArray[CreateFulfillmentOrderItem]

TODO: Write general description for this method

Returns:



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

def items
  @items
end

#marketplace_idMarketplaceId

TODO: Write general description for this method

Returns:



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

def marketplace_id
  @marketplace_id
end

#notification_emailsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def notification_emails
  @notification_emails
end

#seller_fulfillment_order_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def seller_fulfillment_order_id
  @seller_fulfillment_order_id
end

#shipping_speed_categoryShippingSpeedCategory

TODO: Write general description for this method



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

def shipping_speed_category
  @shipping_speed_category
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



103
104
105
106
107
108
109
110
111
112
113
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
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 103

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
  displayable_order_date = if hash.key?('displayableOrderDate')
                             (DateTimeHelper.from_rfc3339(hash['displayableOrderDate']) if hash['displayableOrderDate'])
                           end
  shipping_speed_category =
    hash.key?('shippingSpeedCategory') ? hash['shippingSpeedCategory'] : nil
  destination_address = Address.from_hash(hash['destinationAddress']) if
    hash['destinationAddress']
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (CreateFulfillmentOrderItem.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')
  marketplace_id = hash['marketplaceId'] ||= MarketplaceId::WALMART_US
  displayable_order_comment =
    hash.key?('displayableOrderComment') ? hash['displayableOrderComment'] : SKIP
  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.
  CreateFulfillmentOrderRequest.new(seller_fulfillment_order_id: seller_fulfillment_order_id,
                                    displayable_order_id: displayable_order_id,
                                    displayable_order_date: displayable_order_date,
                                    shipping_speed_category: shipping_speed_category,
                                    destination_address: destination_address,
                                    items: items,
                                    marketplace_id: marketplace_id,
                                    displayable_order_comment: displayable_order_comment,
                                    notification_emails: notification_emails,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['marketplace_id'] = 'marketplaceId'
  @_hash['seller_fulfillment_order_id'] = 'sellerFulfillmentOrderId'
  @_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['items'] = 'items'
  @_hash['notification_emails'] = 'notificationEmails'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 65

def self.optionals
  %w[
    marketplace_id
    displayable_order_comment
    notification_emails
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



170
171
172
173
174
175
176
177
178
179
180
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 170

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id.inspect}, seller_fulfillment_order_id:"\
  " #{@seller_fulfillment_order_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},"\
  " items: #{@items.inspect}, notification_emails: #{@notification_emails.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_displayable_order_dateObject



154
155
156
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 154

def to_custom_displayable_order_date
  DateTimeHelper.to_rfc3339(displayable_order_date)
end

#to_sObject

Provides a human-readable string representation of the object.



159
160
161
162
163
164
165
166
167
# File 'lib/walmart_ap_is/models/create_fulfillment_order_request.rb', line 159

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id}, seller_fulfillment_order_id:"\
  " #{@seller_fulfillment_order_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}, items: #{@items}, notification_emails:"\
  " #{@notification_emails}, additional_properties: #{@additional_properties}>"
end