Class: NewStoreApi::Correlation

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

Overview

Correlation information used to interpret routing attempts by LO uuids

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(current_fulfillment_request_id = nil, current_logistic_order_id = nil, logistic_order_ids = nil) ⇒ Correlation

Returns a new instance of Correlation.



46
47
48
49
50
51
# File 'lib/new_store_api/models/correlation.rb', line 46

def initialize(current_fulfillment_request_id = nil,
               current_logistic_order_id = nil, logistic_order_ids = nil)
  @current_fulfillment_request_id = current_fulfillment_request_id
  @current_logistic_order_id = current_logistic_order_id
  @logistic_order_ids = logistic_order_ids
end

Instance Attribute Details

#current_fulfillment_request_idUUID | String

The current fulfillment request ID to which this item belongs to

Returns:

  • (UUID | String)


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

def current_fulfillment_request_id
  @current_fulfillment_request_id
end

#current_logistic_order_idUUID | String

The current LO uuid with which this sales order item is being routed

Returns:

  • (UUID | String)


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

def current_logistic_order_id
  @current_logistic_order_id
end

#logistic_order_idsArray[UUID | String]

All LO uuids that this item was a part of

Returns:

  • (Array[UUID | String])


22
23
24
# File 'lib/new_store_api/models/correlation.rb', line 22

def logistic_order_ids
  @logistic_order_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/new_store_api/models/correlation.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  current_fulfillment_request_id =
    hash.key?('current_fulfillment_request_id') ? hash['current_fulfillment_request_id'] : nil
  current_logistic_order_id =
    hash.key?('current_logistic_order_id') ? hash['current_logistic_order_id'] : nil
  logistic_order_ids =
    hash.key?('logistic_order_ids') ? hash['logistic_order_ids'] : nil

  # Create object from extracted values.
  Correlation.new(current_fulfillment_request_id,
                  current_logistic_order_id,
                  logistic_order_ids)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
32
# File 'lib/new_store_api/models/correlation.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['current_fulfillment_request_id'] =
    'current_fulfillment_request_id'
  @_hash['current_logistic_order_id'] = 'current_logistic_order_id'
  @_hash['logistic_order_ids'] = 'logistic_order_ids'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
43
44
# File 'lib/new_store_api/models/correlation.rb', line 40

def self.nullables
  %w[
    current_fulfillment_request_id
  ]
end

.optionalsObject

An array for optional fields



35
36
37
# File 'lib/new_store_api/models/correlation.rb', line 35

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



80
81
82
83
84
85
# File 'lib/new_store_api/models/correlation.rb', line 80

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

#to_sObject

Provides a human-readable string representation of the object.



72
73
74
75
76
77
# File 'lib/new_store_api/models/correlation.rb', line 72

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