Class: NewStoreApi::CashboxConfigNewstoreIeV1Dto

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

Overview

CashboxConfigNewstoreIeV1Dto 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(company_number = nil, legal_entity = nil, legal_entity_address = nil, vat_number = nil) ⇒ CashboxConfigNewstoreIeV1Dto

Returns a new instance of CashboxConfigNewstoreIeV1Dto.



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

def initialize(company_number = nil, legal_entity = nil,
               legal_entity_address = nil, vat_number = nil)
  @company_number = company_number
  @legal_entity = legal_entity
  @legal_entity_address = legal_entity_address
  @vat_number = vat_number
end

Instance Attribute Details

#company_numberString

Company Registration Number (CRO) number issued by the CRO (https://cro.ie).

Returns:

  • (String)


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

def company_number
  @company_number
end

Legal entity name in Ireland.

Returns:

  • (String)


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

def legal_entity
  @legal_entity
end

Address of the legal entity.

Returns:



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

def legal_entity_address
  @legal_entity_address
end

#vat_numberString

The VAT identification number of the legal entity.

Returns:

  • (String)


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

def vat_number
  @vat_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/new_store_api/models/cashbox_config_newstore_ie_v1_dto.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  company_number =
    hash.key?('company_number') ? hash['company_number'] : nil
  legal_entity = hash.key?('legal_entity') ? hash['legal_entity'] : nil
  legal_entity_address = AddressDataIeV1Dto.from_hash(hash['legal_entity_address']) if
    hash['legal_entity_address']
  vat_number = hash.key?('vat_number') ? hash['vat_number'] : nil

  # Create object from extracted values.
  CashboxConfigNewstoreIeV1Dto.new(company_number,
                                   legal_entity,
                                   legal_entity_address,
                                   vat_number)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/new_store_api/models/cashbox_config_newstore_ie_v1_dto.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['company_number'] = 'company_number'
  @_hash['legal_entity'] = 'legal_entity'
  @_hash['legal_entity_address'] = 'legal_entity_address'
  @_hash['vat_number'] = 'vat_number'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/new_store_api/models/cashbox_config_newstore_ie_v1_dto.rb', line 40

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/new_store_api/models/cashbox_config_newstore_ie_v1_dto.rb', line 78

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.company_number,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.legal_entity,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.legal_entity_address,
                              ->(val) { AddressDataIeV1Dto.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.vat_number,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['company_number'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['legal_entity'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['legal_entity_address'],
                            ->(val) { AddressDataIeV1Dto.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['vat_number'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/new_store_api/models/cashbox_config_newstore_ie_v1_dto.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} company_number: #{@company_number}, legal_entity: #{@legal_entity},"\
  " legal_entity_address: #{@legal_entity_address}, vat_number: #{@vat_number}>"
end