Class: KoronaCloudClient::ReceiptItem
- Inherits:
-
Object
- Object
- KoronaCloudClient::ReceiptItem
- Defined in:
- lib/korona-cloud-client/models/receipt_item.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#attendance ⇒ Object
Returns the value of attribute attendance.
-
#booking_time ⇒ Object
yyyy-MM-dd’T’HH:mm:ssXXX.
-
#commodity_group ⇒ Object
Returns the value of attribute commodity_group.
-
#delivery_date ⇒ Object
yyyy-MM-dd’T’HH:mm:ssXXX.
-
#description ⇒ Object
Returns the value of attribute description.
-
#discounts ⇒ Object
Returns the value of attribute discounts.
-
#external_references ⇒ Object
Returns the value of attribute external_references.
-
#id ⇒ Object
global object uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#index ⇒ Object
Returns the value of attribute index.
-
#info_texts ⇒ Object
Returns the value of attribute info_texts.
-
#manual_price ⇒ Object
Returns the value of attribute manual_price.
-
#product ⇒ Object
Returns the value of attribute product.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#recognition_number ⇒ Object
the number referencing the product was typed/scanned to create the receipt item.
-
#return_reason ⇒ Object
Returns the value of attribute return_reason.
-
#sector ⇒ Object
Returns the value of attribute sector.
-
#serial_numbers ⇒ Object
Returns the value of attribute serial_numbers.
-
#special_price_configuration ⇒ Object
Returns the value of attribute special_price_configuration.
-
#total ⇒ Object
Returns the value of attribute total.
-
#type ⇒ Object
Returns the value of attribute type.
-
#voucher_transaction ⇒ Object
Returns the value of attribute voucher_transaction.
-
#voucher_transaction_reference ⇒ Object
Returns the value of attribute voucher_transaction_reference.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ReceiptItem
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ReceiptItem
Initializes the object
161 162 163 164 165 166 167 168 169 170 171 172 173 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 161 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaCloudClient::ReceiptItem` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaCloudClient::ReceiptItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'attendance') self.attendance = attributes[:'attendance'] end if attributes.key?(:'booking_time') self.booking_time = attributes[:'booking_time'] end if attributes.key?(:'commodity_group') self.commodity_group = attributes[:'commodity_group'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'discounts') if (value = attributes[:'discounts']).is_a?(Array) self.discounts = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'indent') self.indent = attributes[:'indent'] end if attributes.key?(:'index') self.index = attributes[:'index'] end if attributes.key?(:'info_texts') if (value = attributes[:'info_texts']).is_a?(Array) self.info_texts = value end end if attributes.key?(:'manual_price') self.manual_price = attributes[:'manual_price'] end if attributes.key?(:'product') self.product = attributes[:'product'] end if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] end if attributes.key?(:'sector') self.sector = attributes[:'sector'] end if attributes.key?(:'serial_numbers') if (value = attributes[:'serial_numbers']).is_a?(Array) self.serial_numbers = value end end if attributes.key?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'delivery_date') self.delivery_date = attributes[:'delivery_date'] end if attributes.key?(:'external_references') if (value = attributes[:'external_references']).is_a?(Hash) self.external_references = value end end if attributes.key?(:'recognition_number') self.recognition_number = attributes[:'recognition_number'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'voucher_transaction') self.voucher_transaction = attributes[:'voucher_transaction'] end if attributes.key?(:'voucher_transaction_reference') self.voucher_transaction_reference = attributes[:'voucher_transaction_reference'] end if attributes.key?(:'special_price_configuration') self.special_price_configuration = attributes[:'special_price_configuration'] end if attributes.key?(:'return_reason') self.return_reason = attributes[:'return_reason'] end end |
Instance Attribute Details
#attendance ⇒ Object
Returns the value of attribute attendance.
18 19 20 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 18 def attendance @attendance end |
#booking_time ⇒ Object
yyyy-MM-dd’T’HH:mm:ssXXX
21 22 23 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 21 def booking_time @booking_time end |
#commodity_group ⇒ Object
Returns the value of attribute commodity_group.
23 24 25 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 23 def commodity_group @commodity_group end |
#delivery_date ⇒ Object
yyyy-MM-dd’T’HH:mm:ssXXX
51 52 53 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 51 def delivery_date @delivery_date end |
#description ⇒ Object
Returns the value of attribute description.
25 26 27 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 25 def description @description end |
#discounts ⇒ Object
Returns the value of attribute discounts.
27 28 29 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 27 def discounts @discounts end |
#external_references ⇒ Object
Returns the value of attribute external_references.
53 54 55 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 53 def external_references @external_references end |
#id ⇒ Object
global object uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
30 31 32 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 30 def id @id end |
#indent ⇒ Object
Returns the value of attribute indent.
32 33 34 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 32 def indent @indent end |
#index ⇒ Object
Returns the value of attribute index.
34 35 36 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 34 def index @index end |
#info_texts ⇒ Object
Returns the value of attribute info_texts.
36 37 38 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 36 def info_texts @info_texts end |
#manual_price ⇒ Object
Returns the value of attribute manual_price.
38 39 40 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 38 def manual_price @manual_price end |
#product ⇒ Object
Returns the value of attribute product.
40 41 42 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 40 def product @product end |
#quantity ⇒ Object
Returns the value of attribute quantity.
42 43 44 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 42 def quantity @quantity end |
#recognition_number ⇒ Object
the number referencing the product was typed/scanned to create the receipt item
56 57 58 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 56 def recognition_number @recognition_number end |
#return_reason ⇒ Object
Returns the value of attribute return_reason.
66 67 68 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 66 def return_reason @return_reason end |
#sector ⇒ Object
Returns the value of attribute sector.
44 45 46 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 44 def sector @sector end |
#serial_numbers ⇒ Object
Returns the value of attribute serial_numbers.
46 47 48 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 46 def serial_numbers @serial_numbers end |
#special_price_configuration ⇒ Object
Returns the value of attribute special_price_configuration.
64 65 66 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 64 def special_price_configuration @special_price_configuration end |
#total ⇒ Object
Returns the value of attribute total.
48 49 50 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 48 def total @total end |
#type ⇒ Object
Returns the value of attribute type.
58 59 60 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 58 def type @type end |
#voucher_transaction ⇒ Object
Returns the value of attribute voucher_transaction.
60 61 62 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 60 def voucher_transaction @voucher_transaction end |
#voucher_transaction_reference ⇒ Object
Returns the value of attribute voucher_transaction_reference.
62 63 64 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 62 def voucher_transaction_reference @voucher_transaction_reference end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 381 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = KoronaCloudClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
120 121 122 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 120 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 91 def self.attribute_map { :'attendance' => :'attendance', :'booking_time' => :'bookingTime', :'commodity_group' => :'commodityGroup', :'description' => :'description', :'discounts' => :'discounts', :'id' => :'id', :'indent' => :'indent', :'index' => :'index', :'info_texts' => :'infoTexts', :'manual_price' => :'manualPrice', :'product' => :'product', :'quantity' => :'quantity', :'sector' => :'sector', :'serial_numbers' => :'serialNumbers', :'total' => :'total', :'delivery_date' => :'deliveryDate', :'external_references' => :'externalReferences', :'recognition_number' => :'recognitionNumber', :'type' => :'type', :'voucher_transaction' => :'voucherTransaction', :'voucher_transaction_reference' => :'voucherTransactionReference', :'special_price_configuration' => :'specialPriceConfiguration', :'return_reason' => :'returnReason' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 357 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
154 155 156 157 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 154 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 125 def self.openapi_types { :'attendance' => :'ModelReference', :'booking_time' => :'Time', :'commodity_group' => :'ModelReference', :'description' => :'String', :'discounts' => :'Array<Discount>', :'id' => :'String', :'indent' => :'Integer', :'index' => :'Integer', :'info_texts' => :'Array<Object>', :'manual_price' => :'Boolean', :'product' => :'ModelReference', :'quantity' => :'Float', :'sector' => :'ModelReference', :'serial_numbers' => :'Array<Object>', :'total' => :'TotalPrice', :'delivery_date' => :'Time', :'external_references' => :'Hash<String, String>', :'recognition_number' => :'String', :'type' => :'String', :'voucher_transaction' => :'VoucherTransactionOld', :'voucher_transaction_reference' => :'ModelReference', :'special_price_configuration' => :'ModelReference', :'return_reason' => :'ReceiptItemReturnReason' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 314 def ==(o) return true if self.equal?(o) self.class == o.class && attendance == o.attendance && booking_time == o.booking_time && commodity_group == o.commodity_group && description == o.description && discounts == o.discounts && id == o.id && indent == o.indent && index == o.index && info_texts == o.info_texts && manual_price == o.manual_price && product == o.product && quantity == o.quantity && sector == o.sector && serial_numbers == o.serial_numbers && total == o.total && delivery_date == o.delivery_date && external_references == o.external_references && recognition_number == o.recognition_number && type == o.type && voucher_transaction == o.voucher_transaction && voucher_transaction_reference == o.voucher_transaction_reference && special_price_configuration == o.special_price_configuration && return_reason == o.return_reason end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
452 453 454 455 456 457 458 459 460 461 462 463 464 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 452 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
344 345 346 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 344 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
350 351 352 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 350 def hash [attendance, booking_time, commodity_group, description, discounts, id, indent, index, info_texts, manual_price, product, quantity, sector, serial_numbers, total, delivery_date, external_references, recognition_number, type, voucher_transaction, voucher_transaction_reference, special_price_configuration, return_reason].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
277 278 279 280 281 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 277 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
428 429 430 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 428 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 434 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
422 423 424 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 422 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
285 286 287 288 289 290 |
# File 'lib/korona-cloud-client/models/receipt_item.rb', line 285 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' type_validator = EnumAttributeValidator.new('String', ["PRODUCT", "VOUCHER"]) return false unless type_validator.valid?(@type) true end |