Sha256: 3aa76e94eef7fa8d2efe101a6fa4a5d6764a2f7b599a20dbea2fd071b0e6d0d8

Contents?: true

Size: 596 Bytes

Versions: 9

Compression:

Stored size: 596 Bytes

Contents

# frozen_string_literal: true

require 'date'
require 'codat/base_model'
require 'codat/models/report_item'

module Codat
  module Models
    class BalanceSheetReport < BaseModel
      attributes :date, :net_assets

      attr_accessor :assets, :liabilities, :equity

      def initialize(json: {})
        super

        @assets = ReportItem.new(json: json.fetch(:assets, {}))
        @liabilities = ReportItem.new(json: json.fetch(:liabilities, {}))
        @equity = ReportItem.new(json: json.fetch(:equity, {}))
      end

      def date
        Date.parse(@date)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
codat-0.1.6.2 lib/codat/models/balance_sheet_report.rb
codat-0.1.6.1 lib/codat/models/balance_sheet_report.rb
codat-0.1.8 lib/codat/models/balance_sheet_report.rb
codat-0.1.7 lib/codat/models/balance_sheet_report.rb
codat-0.1.6 lib/codat/models/balance_sheet_report.rb
codat-0.1.5 lib/codat/models/balance_sheet_report.rb
codat-0.1.4 lib/codat/models/balance_sheet_report.rb
codat-0.1.3 lib/codat/models/balance_sheet_report.rb
codat-0.1.2 lib/codat/models/balance_sheet_report.rb