Class: NewStoreApi::CashboxConfigNewStoreInV1Dto

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

Overview

CashboxConfigNewStoreInV1Dto 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(receipt_number_prefix = nil) ⇒ CashboxConfigNewStoreInV1Dto

Returns a new instance of CashboxConfigNewStoreInV1Dto.



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

def initialize(receipt_number_prefix = nil)
  @receipt_number_prefix = receipt_number_prefix
end

Instance Attribute Details

#receipt_number_prefixString

Receipt number prefix that is used to construct the series name used to generate the sequence number, example receipt number: S24-prefix-000001. Should be a unique value that is easily identifiable to track down the origin of the receipt, for example the store Id can be a good fit to be used for this value. Must be 5 characters long to generate a 16 character receipt number that is compliant with the regulations in India.

Returns:

  • (String)


20
21
22
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 20

def receipt_number_prefix
  @receipt_number_prefix
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
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 44

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  receipt_number_prefix =
    hash.key?('receipt_number_prefix') ? hash['receipt_number_prefix'] : nil

  # Create object from extracted values.
  CashboxConfigNewStoreInV1Dto.new(receipt_number_prefix)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 23

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

.nullablesObject

An array for nullable fields



35
36
37
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 35

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 30

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 57

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.receipt_number_prefix,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['receipt_number_prefix'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



76
77
78
79
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 76

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

#to_sObject

Provides a human-readable string representation of the object.



70
71
72
73
# File 'lib/new_store_api/models/cashbox_config_new_store_in_v1_dto.rb', line 70

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