Sha256: 6b180082120c7cf3faeaa9362ed98db7ee5d96179f50eb43f5cf99aa5caccd4c
Contents?: true
Size: 554 Bytes
Versions: 9
Compression:
Stored size: 554 Bytes
Contents
# frozen_string_literal: true require 'codat/base_model' module Codat module Models # A report item can be present in BalanceSheetReport or ProfitAndLossReport. class ReportItem < BaseModel attributes :account_id, :name, :value attr_accessor :items def initialize(json: {}) super # The items can have an array of items inside. It's weird, but this happens a lot. items_json = json.fetch(:items, []) @items = items_json.map { |item| ReportItem.new(json: item) } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems