Class: NewStoreApi::VertexExemptionClassItemCreateDto

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

Overview

VertexExemptionClassItemCreateDto 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, valid_countries = nil, vertex_class_code = nil, display_text = SKIP) ⇒ VertexExemptionClassItemCreateDto

Returns a new instance of VertexExemptionClassItemCreateDto.



62
63
64
65
66
67
68
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 62

def initialize(exemption_class = nil, valid_countries = nil,
               vertex_class_code = nil, display_text = SKIP)
  @display_text = display_text unless display_text == SKIP
  @exemption_class = exemption_class
  @valid_countries = valid_countries
  @vertex_class_code = vertex_class_code
end

Instance Attribute Details

#display_textHash[String, Object]

Display text to be used in Associate App while rendering the exemption class.

  • Required for custom tax exemption classes.
  • Optional for pre-defined tax exemption classes.
  • Keys must be a valid ISO 639-1 language code.
  • Must include English translation by default.

Returns:

  • (Hash[String, Object])


19
20
21
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 19

def display_text
  @display_text
end

#exemption_classExemptionClassEnum

Display text to be used in Associate App while rendering the exemption class.

  • Required for custom tax exemption classes.
  • Optional for pre-defined tax exemption classes.
  • Keys must be a valid ISO 639-1 language code.
  • Must include English translation by default.

Returns:



28
29
30
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 28

def exemption_class
  @exemption_class
end

#valid_countriesArray[TaxExemptionCountryCodeEnum]

The list of countries where this tax exemption class is valid.

Returns:



32
33
34
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 32

def valid_countries
  @valid_countries
end

#vertex_class_codeString

Vertex class code.

  • A code used to represent groups of customers, vendors, dispatchers, or recipients who have similar taxability.

Returns:

  • (String)


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

def vertex_class_code
  @vertex_class_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  exemption_class =
    hash.key?('exemption_class') ? hash['exemption_class'] : nil
  valid_countries =
    hash.key?('valid_countries') ? hash['valid_countries'] : nil
  vertex_class_code =
    hash.key?('vertex_class_code') ? hash['vertex_class_code'] : nil
  display_text = hash.key?('display_text') ? hash['display_text'] : SKIP

  # Create object from extracted values.
  VertexExemptionClassItemCreateDto.new(exemption_class,
                                        valid_countries,
                                        vertex_class_code,
                                        display_text)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 41

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

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 51

def self.optionals
  %w[
    display_text
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
103
# File 'lib/new_store_api/models/vertex_exemption_class_item_create_dto.rb', line 98

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

#to_sObject

Provides a human-readable string representation of the object.



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

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