Class: NewStoreApi::StoreConfigUpdateItV1Dto

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

Overview

StoreConfigUpdateItV1Dto 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(auto_report_types = SKIP, exemption_classes = SKIP, report_types = SKIP, timezone = SKIP) ⇒ StoreConfigUpdateItV1Dto

Returns a new instance of StoreConfigUpdateItV1Dto.



58
59
60
61
62
63
64
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 58

def initialize(auto_report_types = SKIP, exemption_classes = SKIP,
               report_types = SKIP, timezone = SKIP)
  @auto_report_types = auto_report_types unless auto_report_types == SKIP
  @exemption_classes = exemption_classes unless exemption_classes == SKIP
  @report_types = report_types unless report_types == SKIP
  @timezone = timezone unless timezone == SKIP
end

Instance Attribute Details

#auto_report_typesArray[PeriodTypeEnum]

List of periodic report types that should be closed automatically before the first transaction in the next period.

Returns:



15
16
17
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 15

def auto_report_types
  @auto_report_types
end

#exemption_classesArray[ExemptionClassMappingItV1Dto]

List of tax exemption classes and corresponding tax exemption codes.

  • For the configured tax exemption classes, the corresponding tax exemption code will be used while fiscalizing the transaction.
  • For tax exemption classes that are not configured, the default tax exemption code of N3 will be used while fiscalizing the transaction.

Returns:



23
24
25
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 23

def exemption_classes
  @exemption_classes
end

#report_typesArray[PeriodTypeEnum]

List of supported periodic report types.

Returns:



27
28
29
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 27

def report_types
  @report_types
end

#timezoneTimezoneEnum

List of supported periodic report types.

Returns:



31
32
33
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 31

def timezone
  @timezone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auto_report_types =
    hash.key?('auto_report_types') ? hash['auto_report_types'] : SKIP
  # Parameter is an array, so we need to iterate through it
  exemption_classes = nil
  unless hash['exemption_classes'].nil?
    exemption_classes = []
    hash['exemption_classes'].each do |structure|
      exemption_classes << (ExemptionClassMappingItV1Dto.from_hash(structure) if structure)
    end
  end

  exemption_classes = SKIP unless hash.key?('exemption_classes')
  report_types = hash.key?('report_types') ? hash['report_types'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP

  # Create object from extracted values.
  StoreConfigUpdateItV1Dto.new(auto_report_types,
                               exemption_classes,
                               report_types,
                               timezone)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auto_report_types'] = 'auto_report_types'
  @_hash['exemption_classes'] = 'exemption_classes'
  @_hash['report_types'] = 'report_types'
  @_hash['timezone'] = 'timezone'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 44

def self.optionals
  %w[
    auto_report_types
    exemption_classes
    report_types
    timezone
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



95
96
97
98
99
100
101
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 95

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 111

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

#to_sObject

Provides a human-readable string representation of the object.



104
105
106
107
108
# File 'lib/new_store_api/models/store_config_update_it_v1_dto.rb', line 104

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auto_report_types: #{@auto_report_types}, exemption_classes:"\
  " #{@exemption_classes}, report_types: #{@report_types}, timezone: #{@timezone}>"
end