Class: NewStoreApi::Canceled

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

Overview

Canceled 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, parent_logistic_order_uuid = SKIP) ⇒ Canceled

Returns a new instance of Canceled.



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

def initialize(items = SKIP, logistic_order_uuid = SKIP,
               parent_logistic_order_uuid = SKIP)
  @items = items unless items == SKIP
  @logistic_order_uuid = logistic_order_uuid unless logistic_order_uuid == SKIP
  unless parent_logistic_order_uuid == SKIP
    @parent_logistic_order_uuid =
      parent_logistic_order_uuid
  end
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/canceled.rb', line 14

def items
  @items
end

#logistic_order_uuidString

The UUID of the new logistic order that has the cancelled items.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/canceled.rb', line 18

def logistic_order_uuid
  @logistic_order_uuid
end

#parent_logistic_order_uuidString

The identifier of the logistic order that previously contained the rerouted items. This is the logistic order uuid that was specified in the request.

Returns:

  • (String)


24
25
26
# File 'lib/new_store_api/models/canceled.rb', line 24

def parent_logistic_order_uuid
  @parent_logistic_order_uuid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/new_store_api/models/canceled.rb', line 60

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
  parent_logistic_order_uuid =
    hash.key?('parent_logistic_order_uuid') ? hash['parent_logistic_order_uuid'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/new_store_api/models/canceled.rb', line 27

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

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/new_store_api/models/canceled.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/new_store_api/models/canceled.rb', line 36

def self.optionals
  %w[
    items
    logistic_order_uuid
    parent_logistic_order_uuid
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



84
85
86
87
88
89
# File 'lib/new_store_api/models/canceled.rb', line 84

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

#to_sObject

Provides a human-readable string representation of the object.



77
78
79
80
81
# File 'lib/new_store_api/models/canceled.rb', line 77

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