Class: NewStoreApi::InjectedOrderRoutingStrategy1

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

Overview

InjectedOrderRoutingStrategy1 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(fulfillment_node_id = nil) ⇒ InjectedOrderRoutingStrategy1

Returns a new instance of InjectedOrderRoutingStrategy1.



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

def initialize(fulfillment_node_id = nil)
  @fulfillment_node_id = fulfillment_node_id
  @strategy = 'prerouted'
end

Instance Attribute Details

#fulfillment_node_idString

The fulfillment node ID to which the order is going to be routed. The location must have ATP for all items in the order. If there's no ATP for some items, the items are put on hold.

Returns:

  • (String)


17
18
19
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 17

def fulfillment_node_id
  @fulfillment_node_id
end

#strategyString (readonly)

The routing strategy used to specify the fulfillment location for the order, and prevent it from being routed based on the fulfillment config.

Returns:

  • (String)


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

def strategy
  @strategy
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
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 48

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  InjectedOrderRoutingStrategy1.new(fulfillment_node_id)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 33

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 61

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.fulfillment_node_id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.strategy,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['fulfillment_node_id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['strategy'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
# File 'lib/new_store_api/models/injected_order_routing_strategy1.rb', line 82

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