Class: AmznSpApi::FulfillmentOutboundApiModel::CreateFulfillmentOrderRequest

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

Overview

The request body schema for the createFulfillmentOrder operation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateFulfillmentOrderRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


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
121
122
123
124
125
126
127
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 84

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `AmznSpApi::FulfillmentOutboundApiModel::CreateFulfillmentOrderRequest` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `AmznSpApi::FulfillmentOutboundApiModel::CreateFulfillmentOrderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.marketplace_id = attributes[:marketplace_id] if attributes.key?(:marketplace_id)

  self.seller_fulfillment_order_id = attributes[:seller_fulfillment_order_id] if attributes.key?(:seller_fulfillment_order_id)

  self.displayable_order_id = attributes[:displayable_order_id] if attributes.key?(:displayable_order_id)

  self.displayable_order_date = attributes[:displayable_order_date] if attributes.key?(:displayable_order_date)

  self.displayable_order_comment = attributes[:displayable_order_comment] if attributes.key?(:displayable_order_comment)

  self.shipping_speed_category = attributes[:shipping_speed_category] if attributes.key?(:shipping_speed_category)

  self.delivery_window = attributes[:delivery_window] if attributes.key?(:delivery_window)

  self.destination_address = attributes[:destination_address] if attributes.key?(:destination_address)

  self.fulfillment_action = attributes[:fulfillment_action] if attributes.key?(:fulfillment_action)

  self.fulfillment_policy = attributes[:fulfillment_policy] if attributes.key?(:fulfillment_policy)

  self.cod_settings = attributes[:cod_settings] if attributes.key?(:cod_settings)

  self.ship_from_country_code = attributes[:ship_from_country_code] if attributes.key?(:ship_from_country_code)

  self.notification_emails = attributes[:notification_emails] if attributes.key?(:notification_emails)

  if attributes.key?(:feature_constraints) && (value = attributes[:feature_constraints]).is_a?(Array)
    self.feature_constraints = value
  end

  return unless attributes.key?(:items)

  self.items = attributes[:items]
end

Instance Attribute Details

#cod_settingsObject

Returns the value of attribute cod_settings.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def cod_settings
  @cod_settings
end

#delivery_windowObject

Returns the value of attribute delivery_window.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def delivery_window
  @delivery_window
end

#destination_addressObject

Returns the value of attribute destination_address.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def destination_address
  @destination_address
end

#displayable_order_commentObject

Order-specific text that appears in recipient-facing materials such as the outbound shipment packing slip.



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

def displayable_order_comment
  @displayable_order_comment
end

#displayable_order_dateObject

Returns the value of attribute displayable_order_date.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def displayable_order_date
  @displayable_order_date
end

#displayable_order_idObject

A fulfillment order identifier that the seller creates. This value displays as the order identifier in recipient-facing materials such as the outbound shipment packing slip. The value of DisplayableOrderId should match the order identifier that the seller provides to the recipient. The seller can use the SellerFulfillmentOrderId for this value or they can specify an alternate value if they want the recipient to reference an alternate order identifier. The value must be an alpha-numeric or ISO 8859-1 compliant string from one to 40 characters in length. Cannot contain two spaces in a row. Leading and trailing white space is removed.



22
23
24
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 22

def displayable_order_id
  @displayable_order_id
end

#feature_constraintsObject

A list of features and their fulfillment policies to apply to the order.



33
34
35
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 33

def feature_constraints
  @feature_constraints
end

#fulfillment_actionObject

Returns the value of attribute fulfillment_action.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def fulfillment_action
  @fulfillment_action
end

#fulfillment_policyObject

Returns the value of attribute fulfillment_policy.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def fulfillment_policy
  @fulfillment_policy
end

#itemsObject

Returns the value of attribute items.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def items
  @items
end

#marketplace_idObject

The marketplace the fulfillment order is placed against.



16
17
18
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 16

def marketplace_id
  @marketplace_id
end

#notification_emailsObject

Returns the value of attribute notification_emails.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def notification_emails
  @notification_emails
end

#seller_fulfillment_order_idObject

A fulfillment order identifier that the seller creates to track their fulfillment order. The SellerFulfillmentOrderId must be unique for each fulfillment order that a seller creates. If the seller’s system already creates unique order identifiers, then these might be good values for them to use.



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

def seller_fulfillment_order_id
  @seller_fulfillment_order_id
end

#ship_from_country_codeObject

The two-character country code for the country from which the fulfillment order ships. Must be in ISO 3166-1 alpha-2 format.



30
31
32
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 30

def ship_from_country_code
  @ship_from_country_code
end

#shipping_speed_categoryObject

Returns the value of attribute shipping_speed_category.



24
25
26
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 24

def shipping_speed_category
  @shipping_speed_category
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 36

def self.attribute_map
  {
    'marketplace_id': :marketplaceId,
    'seller_fulfillment_order_id': :sellerFulfillmentOrderId,
    'displayable_order_id': :displayableOrderId,
    'displayable_order_date': :displayableOrderDate,
    'displayable_order_comment': :displayableOrderComment,
    'shipping_speed_category': :shippingSpeedCategory,
    'delivery_window': :deliveryWindow,
    'destination_address': :destinationAddress,
    'fulfillment_action': :fulfillmentAction,
    'fulfillment_policy': :fulfillmentPolicy,
    'cod_settings': :codSettings,
    'ship_from_country_code': :shipFromCountryCode,
    'notification_emails': :notificationEmails,
    'feature_constraints': :featureConstraints,
    'items': :items
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



202
203
204
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 202

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



78
79
80
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 78

def self.openapi_nullable
  Set.new([])
end

.openapi_typesObject

Attribute type mapping.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 57

def self.openapi_types
  {
    'marketplace_id': :Object,
    'seller_fulfillment_order_id': :Object,
    'displayable_order_id': :Object,
    'displayable_order_date': :Object,
    'displayable_order_comment': :Object,
    'shipping_speed_category': :Object,
    'delivery_window': :Object,
    'destination_address': :Object,
    'fulfillment_action': :Object,
    'fulfillment_policy': :Object,
    'cod_settings': :Object,
    'ship_from_country_code': :Object,
    'notification_emails': :Object,
    'feature_constraints': :Object,
    'items': :Object
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 166

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    marketplace_id == other.marketplace_id &&
    seller_fulfillment_order_id == other.seller_fulfillment_order_id &&
    displayable_order_id == other.displayable_order_id &&
    displayable_order_date == other.displayable_order_date &&
    displayable_order_comment == other.displayable_order_comment &&
    shipping_speed_category == other.shipping_speed_category &&
    delivery_window == other.delivery_window &&
    destination_address == other.destination_address &&
    fulfillment_action == other.fulfillment_action &&
    fulfillment_policy == other.fulfillment_policy &&
    cod_settings == other.cod_settings &&
    ship_from_country_code == other.ship_from_country_code &&
    notification_emails == other.notification_emails &&
    feature_constraints == other.feature_constraints &&
    items == other.items
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 231

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    AmznSpApi::FulfillmentOutboundApiModel.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 300

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 209

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      send("#{key}=", nil)
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


189
190
191
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 189

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



195
196
197
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 195

def hash
  [marketplace_id, seller_fulfillment_order_id, displayable_order_id, displayable_order_date, displayable_order_comment, shipping_speed_category, delivery_window, destination_address, fulfillment_action, fulfillment_policy, cod_settings, ship_from_country_code, notification_emails, feature_constraints, items].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 131

def list_invalid_properties
  invalid_properties = []
  invalid_properties.push('invalid value for "seller_fulfillment_order_id", seller_fulfillment_order_id cannot be nil.') if @seller_fulfillment_order_id.nil?

  invalid_properties.push('invalid value for "displayable_order_id", displayable_order_id cannot be nil.') if @displayable_order_id.nil?

  invalid_properties.push('invalid value for "displayable_order_date", displayable_order_date cannot be nil.') if @displayable_order_date.nil?

  invalid_properties.push('invalid value for "displayable_order_comment", displayable_order_comment cannot be nil.') if @displayable_order_comment.nil?

  invalid_properties.push('invalid value for "shipping_speed_category", shipping_speed_category cannot be nil.') if @shipping_speed_category.nil?

  invalid_properties.push('invalid value for "destination_address", destination_address cannot be nil.') if @destination_address.nil?

  invalid_properties.push('invalid value for "items", items cannot be nil.') if @items.nil?

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



276
277
278
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 276

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 282

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



270
271
272
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 270

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



152
153
154
155
156
157
158
159
160
161
162
# File 'lib/fulfillment_outbound_api_model/models/create_fulfillment_order_request.rb', line 152

def valid?
  return false if @seller_fulfillment_order_id.nil?
  return false if @displayable_order_id.nil?
  return false if @displayable_order_date.nil?
  return false if @displayable_order_comment.nil?
  return false if @shipping_speed_category.nil?
  return false if @destination_address.nil?
  return false if @items.nil?

  true
end