Class: NewStoreApi::TaxExemption
- Defined in:
- lib/new_store_api/models/tax_exemption.rb
Overview
Order-level tax exemption: the exemption category and certificate number.
Instance Attribute Summary collapse
-
#mclass ⇒ String
The tax exemption category the order qualifies under, for example
CHARITY_ORGANIZATION. -
#number ⇒ String
Tax exemption certificate number.
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(mclass = SKIP, number = SKIP) ⇒ TaxExemption
constructor
A new instance of TaxExemption.
-
#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(mclass = SKIP, number = SKIP) ⇒ TaxExemption
Returns a new instance of TaxExemption.
45 46 47 48 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 45 def initialize(mclass = SKIP, number = SKIP) @mclass = mclass unless mclass == SKIP @number = number unless number == SKIP end |
Instance Attribute Details
#mclass ⇒ String
The tax exemption category the order qualifies under, for example
CHARITY_ORGANIZATION.
15 16 17 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 15 def mclass @mclass end |
#number ⇒ String
Tax exemption certificate number.
19 20 21 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 19 def number @number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mclass = hash.key?('class') ? hash['class'] : SKIP number = hash.key?('number') ? hash['number'] : SKIP # Create object from extracted values. TaxExemption.new(mclass, number) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['mclass'] = 'class' @_hash['number'] = 'number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 41 42 43 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 38 def self.nullables %w[ mclass number ] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 33 34 35 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 30 def self.optionals %w[ mclass number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
70 71 72 73 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 70 def inspect class_name = self.class.name.split('::').last "<#{class_name} mclass: #{@mclass.inspect}, number: #{@number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
64 65 66 67 |
# File 'lib/new_store_api/models/tax_exemption.rb', line 64 def to_s class_name = self.class.name.split('::').last "<#{class_name} mclass: #{@mclass}, number: #{@number}>" end |