Class: NewStoreApi::InjectedOrderRoutingStrategy2
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::InjectedOrderRoutingStrategy2
- Defined in:
- lib/new_store_api/models/injected_order_routing_strategy2.rb
Overview
InjectedOrderRoutingStrategy2 Model.
Instance Attribute Summary collapse
-
#fulfillment_node_id ⇒ String
The fulfillment node ID to which the order will be routed.
-
#strategy ⇒ String
readonly
This routing strategy is used to fulfill a order routed by an external OMS.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(fulfillment_node_id = nil) ⇒ InjectedOrderRoutingStrategy2
constructor
A new instance of InjectedOrderRoutingStrategy2.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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) ⇒ InjectedOrderRoutingStrategy2
Returns a new instance of InjectedOrderRoutingStrategy2.
41 42 43 44 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 41 def initialize(fulfillment_node_id = nil) @fulfillment_node_id = fulfillment_node_id @strategy = 'external' end |
Instance Attribute Details
#fulfillment_node_id ⇒ String
The fulfillment node ID to which the order will be routed. This location must exist in NewStore, otherwise the order will be canceled.
15 16 17 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 15 def fulfillment_node_id @fulfillment_node_id end |
#strategy ⇒ String (readonly)
This routing strategy is used to fulfill a order routed by an external
OMS. If the external strategy is used, the fulfillment_node_id and the
service_level from the shipping_option is required.
21 22 23 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 21 def strategy @strategy end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 47 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. InjectedOrderRoutingStrategy2.new(fulfillment_node_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['fulfillment_node_id'] = 'fulfillment_node_id' @_hash['strategy'] = 'strategy' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 37 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 32 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 60 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
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
87 88 89 90 91 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 87 def inspect class_name = self.class.name.split('::').last "<#{class_name} fulfillment_node_id: #{@fulfillment_node_id.inspect}, strategy:"\ " #{@strategy.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 |
# File 'lib/new_store_api/models/injected_order_routing_strategy2.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} fulfillment_node_id: #{@fulfillment_node_id}, strategy: #{@strategy}>" end |