Class: NewStoreApi::Pricing
- Defined in:
- lib/new_store_api/models/pricing.rb
Overview
Currency and tax treatment for all prices in the payload.
Instance Attribute Summary collapse
-
#currency ⇒ Currency1Enum
The currency for all the prices contained within this payload.
-
#method ⇒ PricingMethodEnum
Specifies whether all item and fulfillment prices include tax (
tax_included) or exclude it (tax_excluded). -
#tax_exemption ⇒ TaxExemption
Optional order-level tax exemption to apply to all prices in the payload.
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(currency = nil, method = nil, tax_exemption = SKIP) ⇒ Pricing
constructor
A new instance of Pricing.
-
#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(currency = nil, method = nil, tax_exemption = SKIP) ⇒ Pricing
Returns a new instance of Pricing.
48 49 50 51 52 |
# File 'lib/new_store_api/models/pricing.rb', line 48 def initialize(currency = nil, method = nil, tax_exemption = SKIP) @currency = currency @method = method @tax_exemption = tax_exemption unless tax_exemption == SKIP end |
Instance Attribute Details
#currency ⇒ Currency1Enum
The currency for all the prices contained within this payload.
14 15 16 |
# File 'lib/new_store_api/models/pricing.rb', line 14 def currency @currency end |
#method ⇒ PricingMethodEnum
Specifies whether all item and fulfillment prices include tax
(tax_included) or exclude it (tax_excluded).
19 20 21 |
# File 'lib/new_store_api/models/pricing.rb', line 19 def method @method end |
#tax_exemption ⇒ TaxExemption
Optional order-level tax exemption to apply to all prices in the payload.
23 24 25 |
# File 'lib/new_store_api/models/pricing.rb', line 23 def tax_exemption @tax_exemption end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/new_store_api/models/pricing.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency = hash.key?('currency') ? hash['currency'] : nil method = hash.key?('method') ? hash['method'] : nil tax_exemption = TaxExemption.from_hash(hash['tax_exemption']) if hash['tax_exemption'] # Create object from extracted values. Pricing.new(currency, method, tax_exemption) 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/pricing.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['method'] = 'method' @_hash['tax_exemption'] = 'tax_exemption' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 45 46 |
# File 'lib/new_store_api/models/pricing.rb', line 42 def self.nullables %w[ tax_exemption ] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 |
# File 'lib/new_store_api/models/pricing.rb', line 35 def self.optionals %w[ tax_exemption ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
77 78 79 80 81 |
# File 'lib/new_store_api/models/pricing.rb', line 77 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, method: #{@method.inspect}, tax_exemption:"\ " #{@tax_exemption.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
70 71 72 73 74 |
# File 'lib/new_store_api/models/pricing.rb', line 70 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, method: #{@method}, tax_exemption:"\ " #{@tax_exemption}>" end |