Class: Zippendo::CreateShipment201Response

Inherits:
ApiModelBase show all
Defined in:
lib/zippendo/models/create_shipment201_response.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateShipment201Response

Initializes the object

Parameters:

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

    Model attributes in the form of hash



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/zippendo/models/create_shipment201_response.rb', line 195

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateShipment201Response` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateShipment201Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'reference')
    self.reference = attributes[:'reference']
  else
    self.reference = nil
  end

  if attributes.key?(:'address_id')
    self.address_id = attributes[:'address_id']
  end

  if attributes.key?(:'service_point_id')
    self.service_point_id = attributes[:'service_point_id']
  end

  if attributes.key?(:'parties')
    if (value = attributes[:'parties']).is_a?(Array)
      self.parties = value
    end
  else
    self.parties = nil
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  else
    self.type = nil
  end

  if attributes.key?(:'carrier_settings')
    self.carrier_settings = attributes[:'carrier_settings']
  else
    self.carrier_settings = nil
  end

  if attributes.key?(:'parcels')
    if (value = attributes[:'parcels']).is_a?(Array)
      self.parcels = value
    end
  else
    self.parcels = nil
  end

  if attributes.key?(:'pickup_details')
    self.pickup_details = attributes[:'pickup_details']
  end

  if attributes.key?(:'term_of_trade')
    self.term_of_trade = attributes[:'term_of_trade']
  else
    self.term_of_trade = 'DAP'
  end

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

  if attributes.key?(:'errors')
    if (value = attributes[:'errors']).is_a?(Array)
      self.errors = value
    end
  else
    self.errors = nil
  end

  if attributes.key?(:'tracking')
    self.tracking = attributes[:'tracking']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'org_id')
    self.org_id = attributes[:'org_id']
  else
    self.org_id = nil
  end

  if attributes.key?(:'order_id')
    self.order_id = attributes[:'order_id']
  end

  if attributes.key?(:'shipping_rule_id')
    self.shipping_rule_id = attributes[:'shipping_rule_id']
  end

  if attributes.key?(:'shipping_rule')
    self.shipping_rule = attributes[:'shipping_rule']
  end

  if attributes.key?(:'label_printer_id')
    self.label_printer_id = attributes[:'label_printer_id']
  end

  if attributes.key?(:'document_printer_id')
    self.document_printer_id = attributes[:'document_printer_id']
  end

  if attributes.key?(:'logs')
    if (value = attributes[:'logs']).is_a?(Array)
      self.logs = value
    end
  else
    self.logs = nil
  end

  if attributes.key?(:'activities')
    if (value = attributes[:'activities']).is_a?(Array)
      self.activities = value
    end
  else
    self.activities = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#activitiesObject

Chronological activity history of the shipment.



78
79
80
# File 'lib/zippendo/models/create_shipment201_response.rb', line 78

def activities
  @activities
end

#address_idObject

Sender address identifier.



25
26
27
# File 'lib/zippendo/models/create_shipment201_response.rb', line 25

def address_id
  @address_id
end

#carrier_settingsObject

Returns the value of attribute carrier_settings.



36
37
38
# File 'lib/zippendo/models/create_shipment201_response.rb', line 36

def carrier_settings
  @carrier_settings
end

#created_atObject

Timestamp when the shipment was created.



81
82
83
# File 'lib/zippendo/models/create_shipment201_response.rb', line 81

def created_at
  @created_at
end

#document_printer_idObject

Printer assigned for documents on this shipment.



72
73
74
# File 'lib/zippendo/models/create_shipment201_response.rb', line 72

def document_printer_id
  @document_printer_id
end

#documentsObject

Documents generated for the shipment (labels, invoices).



47
48
49
# File 'lib/zippendo/models/create_shipment201_response.rb', line 47

def documents
  @documents
end

#errorsObject

Carrier errors recorded for the shipment.



50
51
52
# File 'lib/zippendo/models/create_shipment201_response.rb', line 50

def errors
  @errors
end

#idObject

Unique shipment identifier.



19
20
21
# File 'lib/zippendo/models/create_shipment201_response.rb', line 19

def id
  @id
end

#label_printer_idObject

Printer assigned for labels on this shipment.



69
70
71
# File 'lib/zippendo/models/create_shipment201_response.rb', line 69

def label_printer_id
  @label_printer_id
end

#logsObject

Request/response logs captured during carrier interactions.



75
76
77
# File 'lib/zippendo/models/create_shipment201_response.rb', line 75

def logs
  @logs
end

#order_idObject

Associated order identifier.



61
62
63
# File 'lib/zippendo/models/create_shipment201_response.rb', line 61

def order_id
  @order_id
end

#org_idObject

Owning organization identifier.



58
59
60
# File 'lib/zippendo/models/create_shipment201_response.rb', line 58

def org_id
  @org_id
end

#parcelsObject

Parcels included in the shipment.



39
40
41
# File 'lib/zippendo/models/create_shipment201_response.rb', line 39

def parcels
  @parcels
end

#partiesObject

Parties involved in the shipment (sender, receiver, etc.).



31
32
33
# File 'lib/zippendo/models/create_shipment201_response.rb', line 31

def parties
  @parties
end

#pickup_detailsObject

Returns the value of attribute pickup_details.



41
42
43
# File 'lib/zippendo/models/create_shipment201_response.rb', line 41

def pickup_details
  @pickup_details
end

#referenceObject

Customer-facing shipment reference.



22
23
24
# File 'lib/zippendo/models/create_shipment201_response.rb', line 22

def reference
  @reference
end

#service_point_idObject

Selected carrier service point identifier.



28
29
30
# File 'lib/zippendo/models/create_shipment201_response.rb', line 28

def service_point_id
  @service_point_id
end

#shipping_ruleObject

Returns the value of attribute shipping_rule.



66
67
68
# File 'lib/zippendo/models/create_shipment201_response.rb', line 66

def shipping_rule
  @shipping_rule
end

#shipping_rule_idObject

Applied shipping rule identifier.



64
65
66
# File 'lib/zippendo/models/create_shipment201_response.rb', line 64

def shipping_rule_id
  @shipping_rule_id
end

#statusObject

Lifecycle status of the shipment.



55
56
57
# File 'lib/zippendo/models/create_shipment201_response.rb', line 55

def status
  @status
end

#term_of_tradeObject

Incoterm governing the shipment.



44
45
46
# File 'lib/zippendo/models/create_shipment201_response.rb', line 44

def term_of_trade
  @term_of_trade
end

#trackingObject

Returns the value of attribute tracking.



52
53
54
# File 'lib/zippendo/models/create_shipment201_response.rb', line 52

def tracking
  @tracking
end

#typeObject

Direction of the shipment relative to the organization.



34
35
36
# File 'lib/zippendo/models/create_shipment201_response.rb', line 34

def type
  @type
end

#updated_atObject

Timestamp when the shipment was last updated.



84
85
86
# File 'lib/zippendo/models/create_shipment201_response.rb', line 84

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



139
140
141
# File 'lib/zippendo/models/create_shipment201_response.rb', line 139

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



144
145
146
# File 'lib/zippendo/models/create_shipment201_response.rb', line 144

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/zippendo/models/create_shipment201_response.rb', line 109

def self.attribute_map
  {
    :'id' => :'id',
    :'reference' => :'reference',
    :'address_id' => :'addressId',
    :'service_point_id' => :'servicePointId',
    :'parties' => :'parties',
    :'type' => :'type',
    :'carrier_settings' => :'carrierSettings',
    :'parcels' => :'parcels',
    :'pickup_details' => :'pickupDetails',
    :'term_of_trade' => :'termOfTrade',
    :'documents' => :'documents',
    :'errors' => :'errors',
    :'tracking' => :'tracking',
    :'status' => :'status',
    :'org_id' => :'orgId',
    :'order_id' => :'orderId',
    :'shipping_rule_id' => :'shippingRuleId',
    :'shipping_rule' => :'shippingRule',
    :'label_printer_id' => :'labelPrinterId',
    :'document_printer_id' => :'documentPrinterId',
    :'logs' => :'logs',
    :'activities' => :'activities',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
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



621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'lib/zippendo/models/create_shipment201_response.rb', line 621

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/zippendo/models/create_shipment201_response.rb', line 179

def self.openapi_nullable
  Set.new([
    :'address_id',
    :'service_point_id',
    :'pickup_details',
    :'tracking',
    :'order_id',
    :'shipping_rule_id',
    :'shipping_rule',
    :'label_printer_id',
    :'document_printer_id',
  ])
end

.openapi_typesObject

Attribute type mapping.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/zippendo/models/create_shipment201_response.rb', line 149

def self.openapi_types
  {
    :'id' => :'String',
    :'reference' => :'String',
    :'address_id' => :'String',
    :'service_point_id' => :'String',
    :'parties' => :'Array<CreateShipment201ResponsePartiesInner>',
    :'type' => :'String',
    :'carrier_settings' => :'ListShipments200ResponseDataInnerCarrierSettings',
    :'parcels' => :'Array<CreateShipment201ResponseParcelsInner>',
    :'pickup_details' => :'CreateShipment201ResponsePickupDetails',
    :'term_of_trade' => :'String',
    :'documents' => :'Array<CreateShipment201ResponseDocumentsInner>',
    :'errors' => :'Array<CreateShipment201ResponseErrorsInner>',
    :'tracking' => :'CreateShipment201ResponseTracking',
    :'status' => :'String',
    :'org_id' => :'String',
    :'order_id' => :'String',
    :'shipping_rule_id' => :'String',
    :'shipping_rule' => :'CreateShipment201ResponseShippingRule',
    :'label_printer_id' => :'String',
    :'document_printer_id' => :'String',
    :'logs' => :'Array<CreateShipment201ResponseLogsInner>',
    :'activities' => :'Array<CreateShipment201ResponseActivitiesInner>',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# File 'lib/zippendo/models/create_shipment201_response.rb', line 577

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      reference == o.reference &&
      address_id == o.address_id &&
      service_point_id == o.service_point_id &&
      parties == o.parties &&
      type == o.type &&
      carrier_settings == o.carrier_settings &&
      parcels == o.parcels &&
      pickup_details == o.pickup_details &&
      term_of_trade == o.term_of_trade &&
      documents == o.documents &&
      errors == o.errors &&
      tracking == o.tracking &&
      status == o.status &&
      org_id == o.org_id &&
      order_id == o.order_id &&
      shipping_rule_id == o.shipping_rule_id &&
      shipping_rule == o.shipping_rule &&
      label_printer_id == o.label_printer_id &&
      document_printer_id == o.document_printer_id &&
      logs == o.logs &&
      activities == o.activities &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


608
609
610
# File 'lib/zippendo/models/create_shipment201_response.rb', line 608

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



614
615
616
# File 'lib/zippendo/models/create_shipment201_response.rb', line 614

def hash
  [id, reference, address_id, service_point_id, parties, type, carrier_settings, parcels, pickup_details, term_of_trade, documents, errors, tracking, status, org_id, order_id, shipping_rule_id, shipping_rule, label_printer_id, document_printer_id, logs, activities, created_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/zippendo/models/create_shipment201_response.rb', line 348

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/zippendo/models/create_shipment201_response.rb', line 643

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/zippendo/models/create_shipment201_response.rb', line 412

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @reference.nil?
  return false if @parties.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["outbound", "inbound"])
  return false unless type_validator.valid?(@type)
  return false if @carrier_settings.nil?
  return false if @parcels.nil?
  return false if @term_of_trade.nil?
  return false if @errors.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["draft", "pending", "processing", "dispatched", "partly_dispatched", "error", "cancelled", "on_hold"])
  return false unless status_validator.valid?(@status)
  return false if @org_id.nil?
  return false if @logs.nil?
  return false if @activities.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end