Class: NewStoreApi::SalesOrderGiftWrapping
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::SalesOrderGiftWrapping
- Defined in:
- lib/new_store_api/models/sales_order_gift_wrapping.rb
Overview
Gift wrapping information. This field is not required and will not be present if gift wrapping is not applicable for the order
Instance Attribute Summary collapse
-
#message ⇒ String
Personalised message to be printing on the gift wrapper.
-
#price ⇒ Price1
Personalised message to be printing on the gift wrapper.
-
#tax_lines ⇒ Array[SalesOrderTaxLine]
Detailed tax information.
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(price = nil, message = SKIP, tax_lines = SKIP) ⇒ SalesOrderGiftWrapping
constructor
A new instance of SalesOrderGiftWrapping.
-
#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(price = nil, message = SKIP, tax_lines = SKIP) ⇒ SalesOrderGiftWrapping
Returns a new instance of SalesOrderGiftWrapping.
47 48 49 50 51 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 47 def initialize(price = nil, = SKIP, tax_lines = SKIP) @message = unless == SKIP @price = price @tax_lines = tax_lines unless tax_lines == SKIP end |
Instance Attribute Details
#message ⇒ String
Personalised message to be printing on the gift wrapper.
15 16 17 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 15 def @message end |
#price ⇒ Price1
Personalised message to be printing on the gift wrapper.
19 20 21 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 19 def price @price end |
#tax_lines ⇒ Array[SalesOrderTaxLine]
Detailed tax information.
23 24 25 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 23 def tax_lines @tax_lines end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. price = Price1.from_hash(hash['price']) if hash['price'] = hash.key?('message') ? hash['message'] : SKIP # Parameter is an array, so we need to iterate through it tax_lines = nil unless hash['tax_lines'].nil? tax_lines = [] hash['tax_lines'].each do |structure| tax_lines << (SalesOrderTaxLine.from_hash(structure) if structure) end end tax_lines = SKIP unless hash.key?('tax_lines') # Create object from extracted values. SalesOrderGiftWrapping.new(price, , tax_lines) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['message'] = 'message' @_hash['price'] = 'price' @_hash['tax_lines'] = 'tax_lines' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 35 def self.optionals %w[ message tax_lines ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
84 85 86 87 88 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 84 def inspect class_name = self.class.name.split('::').last "<#{class_name} message: #{@message.inspect}, price: #{@price.inspect}, tax_lines:"\ " #{@tax_lines.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
78 79 80 81 |
# File 'lib/new_store_api/models/sales_order_gift_wrapping.rb', line 78 def to_s class_name = self.class.name.split('::').last "<#{class_name} message: #{@message}, price: #{@price}, tax_lines: #{@tax_lines}>" end |