Class: NewStoreApi::CashboxConfigEfstaPtV1Dto

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

Overview

CashboxConfigEfstaPtV1Dto 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(address = nil, city = nil, label = nil, location_id = nil, postal_code = nil) ⇒ CashboxConfigEfstaPtV1Dto

Returns a new instance of CashboxConfigEfstaPtV1Dto.



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

def initialize(address = nil, city = nil, label = nil, location_id = nil,
               postal_code = nil)
  @address = address
  @city = city
  @label = label
  @location_id = location_id
  @postal_code = postal_code
end

Instance Attribute Details

#addressString

Address of the store, will be used in SAF-T report

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 14

def address
  @address
end

#cityString

City of the store, will be used in SAF-T report

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 18

def city
  @city
end

#labelString

Location short name, will be used in SAF-T report

Returns:

  • (String)


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

def label
  @label
end

#location_idString

Unique identifier of the store (EFSTA location ID) that will be used in receipts. Limited up to 10 characters

Returns:

  • (String)


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

def location_id
  @location_id
end

#postal_codeString

Postal Code of the store, will be used in SAF-T report

Returns:

  • (String)


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

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address = hash.key?('address') ? hash['address'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  label = hash.key?('label') ? hash['label'] : nil
  location_id = hash.key?('location_id') ? hash['location_id'] : nil
  postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil

  # Create object from extracted values.
  CashboxConfigEfstaPtV1Dto.new(address,
                                city,
                                label,
                                location_id,
                                postal_code)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['city'] = 'city'
  @_hash['label'] = 'label'
  @_hash['location_id'] = 'location_id'
  @_hash['postal_code'] = 'postal_code'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 45

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 84

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.address,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.city,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.label,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.location_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.postal_code,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['address'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['city'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['label'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['location_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['postal_code'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
129
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 124

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, city: #{@city.inspect}, label:"\
  " #{@label.inspect}, location_id: #{@location_id.inspect}, postal_code:"\
  " #{@postal_code.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
# File 'lib/new_store_api/models/cashbox_config_efsta_pt_v1_dto.rb', line 117

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address}, city: #{@city}, label: #{@label}, location_id:"\
  " #{@location_id}, postal_code: #{@postal_code}>"
end