Class: NewStoreApi::ExemptionClassItemUpdateDto

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

Overview

ExemptionClassItemUpdateDto 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, display_text = SKIP) ⇒ ExemptionClassItemUpdateDto

Returns a new instance of ExemptionClassItemUpdateDto.



55
56
57
58
59
60
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 55

def initialize(exemption_class = nil, valid_countries = nil,
               display_text = SKIP)
  @display_text = display_text unless display_text == SKIP
  @exemption_class = exemption_class
  @valid_countries = valid_countries
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/exemption_class_item_update_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/exemption_class_item_update_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/exemption_class_item_update_dto.rb', line 32

def valid_countries
  @valid_countries
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 63

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
  display_text = hash.key?('display_text') ? hash['display_text'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 35

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

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 44

def self.optionals
  %w[
    display_text
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 87

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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
# File 'lib/new_store_api/models/exemption_class_item_update_dto.rb', line 80

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