Class: NewStoreApi::Swapped

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

Overview

Swapped 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) ⇒ Swapped

Returns a new instance of Swapped.



42
43
44
45
# File 'lib/new_store_api/models/swapped.rb', line 42

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/swapped.rb', line 14

def items
  @items
end

#logistic_order_uuidString

The identifier of the logistic order which was created to hold original items which were replaced by swapping.

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/swapped.rb', line 19

def logistic_order_uuid
  @logistic_order_uuid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.
  Swapped.new(items,
              logistic_order_uuid)
end

.namesObject

A mapping from model property names to API property names.



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

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



38
39
40
# File 'lib/new_store_api/models/swapped.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    items
    logistic_order_uuid
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



68
69
70
71
72
# File 'lib/new_store_api/models/swapped.rb', line 68

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.



62
63
64
65
# File 'lib/new_store_api/models/swapped.rb', line 62

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