Class: NewStoreApi::CashboxCreateV1Dto

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

Overview

CashboxCreateV1Dto 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(config = nil, fiscal_provider_id = nil) ⇒ CashboxCreateV1Dto

Returns a new instance of CashboxCreateV1Dto.



38
39
40
41
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 38

def initialize(config = nil, fiscal_provider_id = nil)
  @config = config
  @fiscal_provider_id = fiscal_provider_id
end

Instance Attribute Details

#configObject

Fiscal provider configuration.

Returns:

  • (Object)


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

def config
  @config
end

#fiscal_provider_idFiscalProviderIdEnum

Fiscal provider configuration.



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

def fiscal_provider_id
  @fiscal_provider_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 44

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  config = hash.key?('config') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:CashboxCreateV1DtoConfig), hash['config']
  ) : nil
  fiscal_provider_id =
    hash.key?('fiscal_provider_id') ? hash['fiscal_provider_id'] : nil

  # Create object from extracted values.
  CashboxCreateV1Dto.new(config,
                         fiscal_provider_id)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['config'] = 'config'
  @_hash['fiscal_provider_id'] = 'fiscal_provider_id'
  @_hash
end

.nullablesObject

An array for nullable fields



34
35
36
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 34

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 29

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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

def self.validate(value)
  if value.instance_of? self
    return (
      UnionTypeLookUp.get(:CashboxCreateV1DtoConfig)
                     .validate(value.config) and
        APIHelper.valid_type?(value.fiscal_provider_id,
                              ->(val) { FiscalProviderIdEnum.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    UnionTypeLookUp.get(:CashboxCreateV1DtoConfig)
                   .validate(value['config']) and
      APIHelper.valid_type?(value['fiscal_provider_id'],
                            ->(val) { FiscalProviderIdEnum.validate(val) })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
# File 'lib/new_store_api/models/cashbox_create_v1_dto.rb', line 82

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} config: #{@config}, fiscal_provider_id: #{@fiscal_provider_id}>"
end