Class: NewStoreApi::FiscalReceiptResultV1Dto

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

Overview

FiscalReceiptResultV1Dto 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(fiscal_receipt_amount = SKIP, fiscal_receipt_number = SKIP, fiscal_receipt_timestamp = SKIP) ⇒ FiscalReceiptResultV1Dto

Returns a new instance of FiscalReceiptResultV1Dto.



48
49
50
51
52
53
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 48

def initialize(fiscal_receipt_amount = SKIP, fiscal_receipt_number = SKIP,
               fiscal_receipt_timestamp = SKIP)
  @fiscal_receipt_amount = fiscal_receipt_amount unless fiscal_receipt_amount == SKIP
  @fiscal_receipt_number = fiscal_receipt_number unless fiscal_receipt_number == SKIP
  @fiscal_receipt_timestamp = fiscal_receipt_timestamp unless fiscal_receipt_timestamp == SKIP
end

Instance Attribute Details

#fiscal_receipt_amountFloat

Fiscal receipt amount from the fiscal printer.

Returns:

  • (Float)


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

def fiscal_receipt_amount
  @fiscal_receipt_amount
end

#fiscal_receipt_numberInteger

Fiscal receipt number under the current Z-report number from the fiscal printer.

Returns:

  • (Integer)


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

def fiscal_receipt_number
  @fiscal_receipt_number
end

#fiscal_receipt_timestampString

Fiscal receipt ISO timestamp from the fiscal printer.

Returns:

  • (String)


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

def fiscal_receipt_timestamp
  @fiscal_receipt_timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  fiscal_receipt_amount =
    hash.key?('fiscal_receipt_amount') ? hash['fiscal_receipt_amount'] : SKIP
  fiscal_receipt_number =
    hash.key?('fiscal_receipt_number') ? hash['fiscal_receipt_number'] : SKIP
  fiscal_receipt_timestamp =
    hash.key?('fiscal_receipt_timestamp') ? hash['fiscal_receipt_timestamp'] : SKIP

  # Create object from extracted values.
  FiscalReceiptResultV1Dto.new(fiscal_receipt_amount,
                               fiscal_receipt_number,
                               fiscal_receipt_timestamp)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 26

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

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    fiscal_receipt_amount
    fiscal_receipt_number
    fiscal_receipt_timestamp
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



75
76
77
78
79
80
81
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 75

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
96
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 91

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

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/new_store_api/models/fiscal_receipt_result_v1_dto.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} fiscal_receipt_amount: #{@fiscal_receipt_amount}, fiscal_receipt_number:"\
  " #{@fiscal_receipt_number}, fiscal_receipt_timestamp: #{@fiscal_receipt_timestamp}>"
end