Class: NewStoreApi::OrderConflictResolutionResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::OrderConflictResolutionResponse
- Defined in:
- lib/new_store_api/models/order_conflict_resolution_response.rb
Overview
Returns logistic orders along with their items that were rerouted, cancelled and failed to process. Using the response clients can identify the cancelled and rerouted items. Note that items belong to new logistic order after cancelled and reroute.
Instance Attribute Summary collapse
-
#canceled ⇒ Array[Canceled]
TODO: Write general description for this method.
-
#error ⇒ Error
TODO: Write general description for this method.
-
#rerouted ⇒ Array[Rerouted]
TODO: Write general description for this method.
-
#swapped ⇒ Array[Swapped]
This array contains LOs with original items which were replaced by swapping.
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.
Instance Method Summary collapse
-
#initialize(canceled = SKIP, error = SKIP, rerouted = SKIP, swapped = SKIP) ⇒ OrderConflictResolutionResponse
constructor
A new instance of OrderConflictResolutionResponse.
-
#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(canceled = SKIP, error = SKIP, rerouted = SKIP, swapped = SKIP) ⇒ OrderConflictResolutionResponse
Returns a new instance of OrderConflictResolutionResponse.
59 60 61 62 63 64 65 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 59 def initialize(canceled = SKIP, error = SKIP, rerouted = SKIP, swapped = SKIP) @canceled = canceled unless canceled == SKIP @error = error unless error == SKIP @rerouted = rerouted unless rerouted == SKIP @swapped = swapped unless swapped == SKIP end |
Instance Attribute Details
#canceled ⇒ Array[Canceled]
TODO: Write general description for this method
17 18 19 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 17 def canceled @canceled end |
#error ⇒ Error
TODO: Write general description for this method
21 22 23 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 21 def error @error end |
#rerouted ⇒ Array[Rerouted]
TODO: Write general description for this method
25 26 27 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 25 def rerouted @rerouted end |
#swapped ⇒ Array[Swapped]
This array contains LOs with original items which were replaced by
swapping. Whenever we do swapping we create an LO which contains original
items which we replaced by swapping. This LO also child of conflicted LO.
Right after creation this will be moved to swapped state.
32 33 34 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 32 def swapped @swapped end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it canceled = nil unless hash['canceled'].nil? canceled = [] hash['canceled'].each do |structure| canceled << (Canceled.from_hash(structure) if structure) end end canceled = SKIP unless hash.key?('canceled') error = Error.from_hash(hash['error']) if hash['error'] # Parameter is an array, so we need to iterate through it rerouted = nil unless hash['rerouted'].nil? rerouted = [] hash['rerouted'].each do |structure| rerouted << (Rerouted.from_hash(structure) if structure) end end rerouted = SKIP unless hash.key?('rerouted') # Parameter is an array, so we need to iterate through it swapped = nil unless hash['swapped'].nil? swapped = [] hash['swapped'].each do |structure| swapped << (Swapped.from_hash(structure) if structure) end end swapped = SKIP unless hash.key?('swapped') # Create object from extracted values. OrderConflictResolutionResponse.new(canceled, error, rerouted, swapped) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['canceled'] = 'canceled' @_hash['error'] = 'error' @_hash['rerouted'] = 'rerouted' @_hash['swapped'] = 'swapped' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 45 def self.optionals %w[ canceled error rerouted swapped ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} canceled: #{@canceled.inspect}, error: #{@error.inspect}, rerouted:"\ " #{@rerouted.inspect}, swapped: #{@swapped.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 |
# File 'lib/new_store_api/models/order_conflict_resolution_response.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} canceled: #{@canceled}, error: #{@error}, rerouted: #{@rerouted}, swapped:"\ " #{@swapped}>" end |