Class: NewStoreApi::CashboxV1Dto
- Defined in:
- lib/new_store_api/models/cashbox_v1_dto.rb
Overview
CashboxV1Dto Model.
Instance Attribute Summary collapse
-
#activated_at ⇒ DateTime
Timestamp of the cashbox activation.
-
#config ⇒ Object
Fiscal provider configuration.
-
#deactivated_at ⇒ DateTime
Timestamp of the cashbox deactivation.
-
#fiscal_provider_id ⇒ FiscalProviderIdEnum
Timestamp of the cashbox deactivation.
-
#id ⇒ String
Cashbox identifier.
-
#state ⇒ CashboxStateEnum
Cashbox identifier.
-
#store_id ⇒ String
Store identifier that the cashbox belongs to.
-
#tenant ⇒ String
Tenant identifier.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(activated_at = nil, config = nil, fiscal_provider_id = nil, id = nil, state = nil, store_id = nil, tenant = nil, deactivated_at = SKIP) ⇒ CashboxV1Dto
constructor
A new instance of CashboxV1Dto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_activated_at ⇒ Object
- #to_custom_deactivated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(activated_at = nil, config = nil, fiscal_provider_id = nil, id = nil, state = nil, store_id = nil, tenant = nil, deactivated_at = SKIP) ⇒ CashboxV1Dto
Returns a new instance of CashboxV1Dto.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 71 def initialize(activated_at = nil, config = nil, fiscal_provider_id = nil, id = nil, state = nil, store_id = nil, tenant = nil, deactivated_at = SKIP) @activated_at = activated_at @config = config @deactivated_at = deactivated_at unless deactivated_at == SKIP @fiscal_provider_id = fiscal_provider_id @id = id @state = state @store_id = store_id @tenant = tenant end |
Instance Attribute Details
#activated_at ⇒ DateTime
Timestamp of the cashbox activation.
15 16 17 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 15 def activated_at @activated_at end |
#config ⇒ Object
Fiscal provider configuration.
19 20 21 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 19 def config @config end |
#deactivated_at ⇒ DateTime
Timestamp of the cashbox deactivation.
23 24 25 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 23 def deactivated_at @deactivated_at end |
#fiscal_provider_id ⇒ FiscalProviderIdEnum
Timestamp of the cashbox deactivation.
27 28 29 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 27 def fiscal_provider_id @fiscal_provider_id end |
#id ⇒ String
Cashbox identifier.
31 32 33 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 31 def id @id end |
#state ⇒ CashboxStateEnum
Cashbox identifier.
35 36 37 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 35 def state @state end |
#store_id ⇒ String
Store identifier that the cashbox belongs to.
39 40 41 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 39 def store_id @store_id end |
#tenant ⇒ String
Tenant identifier.
43 44 45 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 43 def tenant @tenant end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 115 116 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. activated_at = if hash.key?('activated_at') (DateTimeHelper.from_rfc3339(hash['activated_at']) if hash['activated_at']) end config = hash.key?('config') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CashboxV1DtoConfig), hash['config'] ) : nil fiscal_provider_id = hash.key?('fiscal_provider_id') ? hash['fiscal_provider_id'] : nil id = hash.key?('id') ? hash['id'] : nil state = hash.key?('state') ? hash['state'] : nil store_id = hash.key?('store_id') ? hash['store_id'] : nil tenant = hash.key?('tenant') ? hash['tenant'] : nil deactivated_at = if hash.key?('deactivated_at') (DateTimeHelper.from_rfc3339(hash['deactivated_at']) if hash['deactivated_at']) else SKIP end # Create object from extracted values. CashboxV1Dto.new(activated_at, config, fiscal_provider_id, id, state, store_id, tenant, deactivated_at) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['activated_at'] = 'activated_at' @_hash['config'] = 'config' @_hash['deactivated_at'] = 'deactivated_at' @_hash['fiscal_provider_id'] = 'fiscal_provider_id' @_hash['id'] = 'id' @_hash['state'] = 'state' @_hash['store_id'] = 'store_id' @_hash['tenant'] = 'tenant' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 60 def self.optionals %w[ deactivated_at ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 128 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.activated_at, ->(val) { val.instance_of? DateTime }) and UnionTypeLookUp.get(:CashboxV1DtoConfig) .validate(value.config) and APIHelper.valid_type?(value.fiscal_provider_id, ->(val) { FiscalProviderIdEnum.validate(val) }) and APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.state, ->(val) { CashboxStateEnum.validate(val) }) and APIHelper.valid_type?(value.store_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.tenant, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['activated_at'], ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:CashboxV1DtoConfig) .validate(value['config']) and APIHelper.valid_type?(value['fiscal_provider_id'], ->(val) { FiscalProviderIdEnum.validate(val) }) and APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['state'], ->(val) { CashboxStateEnum.validate(val) }) and APIHelper.valid_type?(value['store_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['tenant'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
177 178 179 180 181 182 183 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 177 def inspect class_name = self.class.name.split('::').last "<#{class_name} activated_at: #{@activated_at.inspect}, config: #{@config.inspect},"\ " deactivated_at: #{@deactivated_at.inspect}, fiscal_provider_id:"\ " #{@fiscal_provider_id.inspect}, id: #{@id.inspect}, state: #{@state.inspect}, store_id:"\ " #{@store_id.inspect}, tenant: #{@tenant.inspect}>" end |
#to_custom_activated_at ⇒ Object
118 119 120 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 118 def to_custom_activated_at DateTimeHelper.to_rfc3339(activated_at) end |
#to_custom_deactivated_at ⇒ Object
122 123 124 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 122 def to_custom_deactivated_at DateTimeHelper.to_rfc3339(deactivated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
169 170 171 172 173 174 |
# File 'lib/new_store_api/models/cashbox_v1_dto.rb', line 169 def to_s class_name = self.class.name.split('::').last "<#{class_name} activated_at: #{@activated_at}, config: #{@config}, deactivated_at:"\ " #{@deactivated_at}, fiscal_provider_id: #{@fiscal_provider_id}, id: #{@id}, state:"\ " #{@state}, store_id: #{@store_id}, tenant: #{@tenant}>" end |