Class: ModulePos::Fiscalization::Entities::Base

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/module_pos/fiscalization/entities/base.rb

Instance Method Summary collapse

Instance Method Details

#as_jsonHash Also known as: to_h

Return camelize hash for request

Returns:

  • (Hash)


19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/module_pos/fiscalization/entities/base.rb', line 19

def as_json(*)
  ApiUtils.camelize_keys attributes, ->(val) {
    case val
    when Base
      val.as_json
    when BigDecimal
      val.to_f
    else
      val
    end
  }
end

#to_jsonObject



33
34
35
# File 'lib/module_pos/fiscalization/entities/base.rb', line 33

def to_json
  to_h.to_json
end