Class: NewStoreApi::Rerouted

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/rerouted.rb

Overview

Rerouted 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(items = SKIP, logistic_order_uuid = SKIP) ⇒ Rerouted

Returns a new instance of Rerouted.



43
44
45
46
# File 'lib/new_store_api/models/rerouted.rb', line 43

def initialize(items = SKIP, logistic_order_uuid = SKIP)
  @items = items unless items == SKIP
  @logistic_order_uuid = logistic_order_uuid unless logistic_order_uuid == SKIP
end

Instance Attribute Details

#itemsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


14
15
16
# File 'lib/new_store_api/models/rerouted.rb', line 14

def items
  @items
end

#logistic_order_uuidString

The identifier of the logistic order that holds items to be rerouted. Note this is not the rerouted logistic order, but still the conflicted logistic order that now only contains items to be rerouted.

Returns:

  • (String)


20
21
22
# File 'lib/new_store_api/models/rerouted.rb', line 20

def logistic_order_uuid
  @logistic_order_uuid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/new_store_api/models/rerouted.rb', line 49

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  items = hash.key?('items') ? hash['items'] : SKIP
  logistic_order_uuid =
    hash.key?('logistic_order_uuid') ? hash['logistic_order_uuid'] : SKIP

  # Create object from extracted values.
  Rerouted.new(items,
               logistic_order_uuid)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
28
# File 'lib/new_store_api/models/rerouted.rb', line 23

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['items'] = 'items'
  @_hash['logistic_order_uuid'] = 'logistic_order_uuid'
  @_hash
end

.nullablesObject

An array for nullable fields



39
40
41
# File 'lib/new_store_api/models/rerouted.rb', line 39

def self.nullables
  []
end

.optionalsObject

An array for optional fields



31
32
33
34
35
36
# File 'lib/new_store_api/models/rerouted.rb', line 31

def self.optionals
  %w[
    items
    logistic_order_uuid
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



69
70
71
72
73
# File 'lib/new_store_api/models/rerouted.rb', line 69

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

#to_sObject

Provides a human-readable string representation of the object.



63
64
65
66
# File 'lib/new_store_api/models/rerouted.rb', line 63

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} items: #{@items}, logistic_order_uuid: #{@logistic_order_uuid}>"
end