Class: NewStoreApi::OrderConflictResolutionRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::OrderConflictResolutionRequest
- Defined in:
- lib/new_store_api/models/order_conflict_resolution_request.rb
Overview
Triggers processing of logistic orders in 'conflict' state. Specific action (cancel, reroute, swap, etc) for each conflicted item in order must be defined.
Instance Attribute Summary collapse
-
#items ⇒ Array[Object]
Complete list of items and actions to be performed on them (reroute/cancel or swap).
-
#order_id ⇒ String
The internal identifier(Sales Order UUID) of the order that we want to fix.
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(items = nil, order_id = nil) ⇒ OrderConflictResolutionRequest
constructor
A new instance of OrderConflictResolutionRequest.
-
#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(items = nil, order_id = nil) ⇒ OrderConflictResolutionRequest
Returns a new instance of OrderConflictResolutionRequest.
42 43 44 45 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 42 def initialize(items = nil, order_id = nil) @items = items @order_id = order_id end |
Instance Attribute Details
#items ⇒ Array[Object]
Complete list of items and actions to be performed on them (reroute/cancel or swap).
17 18 19 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 17 def items @items end |
#order_id ⇒ String
The internal identifier(Sales Order UUID) of the order that we want to fix.
22 23 24 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 22 def order_id @order_id 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 60 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. items = hash.key?('items') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:OrderConflictResolutionRequestItems), hash['items'] ) : nil order_id = hash.key?('order_id') ? hash['order_id'] : nil # Create object from extracted values. OrderConflictResolutionRequest.new(items, order_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['items'] = 'items' @_hash['order_id'] = 'order_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 38 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 33 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 64 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:OrderConflictResolutionRequestItems) .validate(value.items) and APIHelper.valid_type?(value.order_id, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:OrderConflictResolutionRequestItems) .validate(value['items']) and APIHelper.valid_type?(value['order_id'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
91 92 93 94 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 91 def inspect class_name = self.class.name.split('::').last "<#{class_name} items: #{@items.inspect}, order_id: #{@order_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
85 86 87 88 |
# File 'lib/new_store_api/models/order_conflict_resolution_request.rb', line 85 def to_s class_name = self.class.name.split('::').last "<#{class_name} items: #{@items}, order_id: #{@order_id}>" end |