Class: NewStoreApi::ExemptionClassMappingItV1Dto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb

Overview

ExemptionClassMappingItV1Dto Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(exemption_class = nil, exemption_code = nil) ⇒ ExemptionClassMappingItV1Dto

Returns a new instance of ExemptionClassMappingItV1Dto.



42
43
44
45
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 42

def initialize(exemption_class = nil, exemption_code = nil)
  @exemption_class = exemption_class
  @exemption_code = exemption_code
end

Instance Attribute Details

#exemption_classString

Tax exemption class.

  • Tax exemption class that is set for the order when tax exemption is applied to the cart.

Returns:

  • (String)


16
17
18
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 16

def exemption_class
  @exemption_class
end

#exemption_codeExemptionCodeItEnum

Tax exemption class.

  • Tax exemption class that is set for the order when tax exemption is applied to the cart.

Returns:



22
23
24
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 22

def exemption_code
  @exemption_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  exemption_class =
    hash.key?('exemption_class') ? hash['exemption_class'] : nil
  exemption_code =
    hash.key?('exemption_code') ? hash['exemption_code'] : nil

  # Create object from extracted values.
  ExemptionClassMappingItV1Dto.new(exemption_class,
                                   exemption_code)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['exemption_class'] = 'exemption_class'
  @_hash['exemption_code'] = 'exemption_code'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 33

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 64

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.exemption_class,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.exemption_code,
                              ->(val) { ExemptionCodeItEnum.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['exemption_class'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['exemption_code'],
                            ->(val) { ExemptionCodeItEnum.validate(val) })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} exemption_class: #{@exemption_class.inspect}, exemption_code:"\
  " #{@exemption_code.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
# File 'lib/new_store_api/models/exemption_class_mapping_it_v1_dto.rb', line 85

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} exemption_class: #{@exemption_class}, exemption_code: #{@exemption_code}>"
end