Class: NewStoreApi::Item12
- Defined in:
- lib/new_store_api/models/item12.rb
Overview
Item12 Model.
Instance Attribute Summary collapse
-
#adjustment_reason ⇒ String
The reason why the refund amount for this item was adjusted.
-
#condition_code ⇒ Integer
The corresponding code for the item condition.
-
#external_identifiers ⇒ ExternalIdentifiers1
External product identifiers for this return item.
-
#id ⇒ String
The identifier of this returned item.
-
#item_condition ⇒ String
The condition of the item, checked while doing quality inspection.
-
#item_type ⇒ String
Type of the returned item.
-
#product_id ⇒ String
The identifier of the corresponding product.
-
#quantity ⇒ Integer
The returned quantity (always one item per line).
-
#refund_amount ⇒ Float
Refund amount of this item before adjustment due to return policy.
-
#refund_amount_adjusted ⇒ Float
Refund amount of this item after adjustment due to return policy.
-
#refund_excl_tax ⇒ Float
Refund amount of this item without taxes.
-
#refund_tax ⇒ Float
Refund tax of this item.
-
#return_code ⇒ Integer
The corresponding code for the return reason.
-
#return_reason ⇒ String
The reason why this item was returned.
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(id = nil, product_id = nil, quantity = nil, refund_amount = nil, refund_amount_adjusted = nil, refund_excl_tax = nil, refund_tax = nil, adjustment_reason = SKIP, condition_code = SKIP, external_identifiers = SKIP, item_condition = SKIP, item_type = SKIP, return_code = SKIP, return_reason = SKIP) ⇒ Item12
constructor
A new instance of Item12.
-
#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(id = nil, product_id = nil, quantity = nil, refund_amount = nil, refund_amount_adjusted = nil, refund_excl_tax = nil, refund_tax = nil, adjustment_reason = SKIP, condition_code = SKIP, external_identifiers = SKIP, item_condition = SKIP, item_type = SKIP, return_code = SKIP, return_reason = SKIP) ⇒ Item12
Returns a new instance of Item12.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/new_store_api/models/item12.rb', line 107 def initialize(id = nil, product_id = nil, quantity = nil, refund_amount = nil, refund_amount_adjusted = nil, refund_excl_tax = nil, refund_tax = nil, adjustment_reason = SKIP, condition_code = SKIP, external_identifiers = SKIP, item_condition = SKIP, item_type = SKIP, return_code = SKIP, return_reason = SKIP) @adjustment_reason = adjustment_reason unless adjustment_reason == SKIP @condition_code = condition_code unless condition_code == SKIP @external_identifiers = external_identifiers unless external_identifiers == SKIP @id = id @item_condition = item_condition unless item_condition == SKIP @item_type = item_type unless item_type == SKIP @product_id = product_id @quantity = quantity @refund_amount = refund_amount @refund_amount_adjusted = refund_amount_adjusted @refund_excl_tax = refund_excl_tax @refund_tax = refund_tax @return_code = return_code unless return_code == SKIP @return_reason = return_reason unless return_reason == SKIP end |
Instance Attribute Details
#adjustment_reason ⇒ String
The reason why the refund amount for this item was adjusted.
14 15 16 |
# File 'lib/new_store_api/models/item12.rb', line 14 def adjustment_reason @adjustment_reason end |
#condition_code ⇒ Integer
The corresponding code for the item condition.
18 19 20 |
# File 'lib/new_store_api/models/item12.rb', line 18 def condition_code @condition_code end |
#external_identifiers ⇒ ExternalIdentifiers1
External product identifiers for this return item.
22 23 24 |
# File 'lib/new_store_api/models/item12.rb', line 22 def external_identifiers @external_identifiers end |
#id ⇒ String
The identifier of this returned item. It is the same identifier as used for this item in the original order.
27 28 29 |
# File 'lib/new_store_api/models/item12.rb', line 27 def id @id end |
#item_condition ⇒ String
The condition of the item, checked while doing quality inspection.
31 32 33 |
# File 'lib/new_store_api/models/item12.rb', line 31 def item_condition @item_condition end |
#item_type ⇒ String
Type of the returned item. For example 'product' or 'shipping'.
35 36 37 |
# File 'lib/new_store_api/models/item12.rb', line 35 def item_type @item_type end |
#product_id ⇒ String
The identifier of the corresponding product.
39 40 41 |
# File 'lib/new_store_api/models/item12.rb', line 39 def product_id @product_id end |
#quantity ⇒ Integer
The returned quantity (always one item per line).
43 44 45 |
# File 'lib/new_store_api/models/item12.rb', line 43 def quantity @quantity end |
#refund_amount ⇒ Float
Refund amount of this item before adjustment due to return policy.
47 48 49 |
# File 'lib/new_store_api/models/item12.rb', line 47 def refund_amount @refund_amount end |
#refund_amount_adjusted ⇒ Float
Refund amount of this item after adjustment due to return policy.
51 52 53 |
# File 'lib/new_store_api/models/item12.rb', line 51 def refund_amount_adjusted @refund_amount_adjusted end |
#refund_excl_tax ⇒ Float
Refund amount of this item without taxes.
55 56 57 |
# File 'lib/new_store_api/models/item12.rb', line 55 def refund_excl_tax @refund_excl_tax end |
#refund_tax ⇒ Float
Refund tax of this item.
59 60 61 |
# File 'lib/new_store_api/models/item12.rb', line 59 def refund_tax @refund_tax end |
#return_code ⇒ Integer
The corresponding code for the return reason.
63 64 65 |
# File 'lib/new_store_api/models/item12.rb', line 63 def return_code @return_code end |
#return_reason ⇒ String
The reason why this item was returned.
67 68 69 |
# File 'lib/new_store_api/models/item12.rb', line 67 def return_reason @return_reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/new_store_api/models/item12.rb', line 130 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil product_id = hash.key?('product_id') ? hash['product_id'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil refund_amount = hash.key?('refund_amount') ? hash['refund_amount'] : nil refund_amount_adjusted = hash.key?('refund_amount_adjusted') ? hash['refund_amount_adjusted'] : nil refund_excl_tax = hash.key?('refund_excl_tax') ? hash['refund_excl_tax'] : nil refund_tax = hash.key?('refund_tax') ? hash['refund_tax'] : nil adjustment_reason = hash.key?('adjustment_reason') ? hash['adjustment_reason'] : SKIP condition_code = hash.key?('condition_code') ? hash['condition_code'] : SKIP external_identifiers = ExternalIdentifiers1.from_hash(hash['external_identifiers']) if hash['external_identifiers'] item_condition = hash.key?('item_condition') ? hash['item_condition'] : SKIP item_type = hash.key?('item_type') ? hash['item_type'] : SKIP return_code = hash.key?('return_code') ? hash['return_code'] : SKIP return_reason = hash.key?('return_reason') ? hash['return_reason'] : SKIP # Create object from extracted values. Item12.new(id, product_id, quantity, refund_amount, refund_amount_adjusted, refund_excl_tax, refund_tax, adjustment_reason, condition_code, external_identifiers, item_condition, item_type, return_code, return_reason) end |
.names ⇒ Object
A mapping from model property names to API property names.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/new_store_api/models/item12.rb', line 70 def self.names @_hash = {} if @_hash.nil? @_hash['adjustment_reason'] = 'adjustment_reason' @_hash['condition_code'] = 'condition_code' @_hash['external_identifiers'] = 'external_identifiers' @_hash['id'] = 'id' @_hash['item_condition'] = 'item_condition' @_hash['item_type'] = 'item_type' @_hash['product_id'] = 'product_id' @_hash['quantity'] = 'quantity' @_hash['refund_amount'] = 'refund_amount' @_hash['refund_amount_adjusted'] = 'refund_amount_adjusted' @_hash['refund_excl_tax'] = 'refund_excl_tax' @_hash['refund_tax'] = 'refund_tax' @_hash['return_code'] = 'return_code' @_hash['return_reason'] = 'return_reason' @_hash end |
.nullables ⇒ Object
An array for nullable fields
103 104 105 |
# File 'lib/new_store_api/models/item12.rb', line 103 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/new_store_api/models/item12.rb', line 90 def self.optionals %w[ adjustment_reason condition_code external_identifiers item_condition item_type return_code return_reason ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/new_store_api/models/item12.rb', line 174 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.product_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.quantity, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.refund_amount, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.refund_amount_adjusted, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.refund_excl_tax, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.refund_tax, ->(val) { val.instance_of? Float }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['product_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['quantity'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['refund_amount'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['refund_amount_adjusted'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['refund_excl_tax'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['refund_tax'], ->(val) { val.instance_of? Float }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/new_store_api/models/item12.rb', line 226 def inspect class_name = self.class.name.split('::').last "<#{class_name} adjustment_reason: #{@adjustment_reason.inspect}, condition_code:"\ " #{@condition_code.inspect}, external_identifiers: #{@external_identifiers.inspect}, id:"\ " #{@id.inspect}, item_condition: #{@item_condition.inspect}, item_type:"\ " #{@item_type.inspect}, product_id: #{@product_id.inspect}, quantity: #{@quantity.inspect},"\ " refund_amount: #{@refund_amount.inspect}, refund_amount_adjusted:"\ " #{@refund_amount_adjusted.inspect}, refund_excl_tax: #{@refund_excl_tax.inspect},"\ " refund_tax: #{@refund_tax.inspect}, return_code: #{@return_code.inspect}, return_reason:"\ " #{@return_reason.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
215 216 217 218 219 220 221 222 223 |
# File 'lib/new_store_api/models/item12.rb', line 215 def to_s class_name = self.class.name.split('::').last "<#{class_name} adjustment_reason: #{@adjustment_reason}, condition_code:"\ " #{@condition_code}, external_identifiers: #{@external_identifiers}, id: #{@id},"\ " item_condition: #{@item_condition}, item_type: #{@item_type}, product_id: #{@product_id},"\ " quantity: #{@quantity}, refund_amount: #{@refund_amount}, refund_amount_adjusted:"\ " #{@refund_amount_adjusted}, refund_excl_tax: #{@refund_excl_tax}, refund_tax:"\ " #{@refund_tax}, return_code: #{@return_code}, return_reason: #{@return_reason}>" end |