Class: NewStoreApi::RoutingStrategy1

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

Overview

Prerouted strategy. Each line item will be assigned to each fulfillment node.

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_ids = nil, service_level_identifier = nil, strategy = 'prerouted') ⇒ RoutingStrategy1

Returns a new instance of RoutingStrategy1.



44
45
46
47
48
49
# File 'lib/new_store_api/models/routing_strategy1.rb', line 44

def initialize(fulfillment_node_ids = nil, service_level_identifier = nil,
               strategy = 'prerouted')
  @fulfillment_node_ids = fulfillment_node_ids
  @service_level_identifier = service_level_identifier
  @strategy = strategy
end

Instance Attribute Details

#fulfillment_node_idsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


15
16
17
# File 'lib/new_store_api/models/routing_strategy1.rb', line 15

def fulfillment_node_ids
  @fulfillment_node_ids
end

#service_level_identifierString

TODO: Write general description for this method

Returns:

  • (String)


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

def service_level_identifier
  @service_level_identifier
end

#strategyString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/routing_strategy1.rb', line 23

def strategy
  @strategy
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/new_store_api/models/routing_strategy1.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  fulfillment_node_ids =
    hash.key?('fulfillment_node_ids') ? hash['fulfillment_node_ids'] : nil
  service_level_identifier =
    hash.key?('service_level_identifier') ? hash['service_level_identifier'] : nil
  strategy = hash['strategy'] ||= 'prerouted'

  # Create object from extracted values.
  RoutingStrategy1.new(fulfillment_node_ids,
                       service_level_identifier,
                       strategy)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/new_store_api/models/routing_strategy1.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/new_store_api/models/routing_strategy1.rb', line 70

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.fulfillment_node_ids,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.service_level_identifier,
                              ->(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_ids'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['service_level_identifier'],
                            ->(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.



102
103
104
105
106
107
# File 'lib/new_store_api/models/routing_strategy1.rb', line 102

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

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/new_store_api/models/routing_strategy1.rb', line 95

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