class Codat::Models::ProfitAndLossReport

Attributes

cost_of_sales[RW]
expenses[RW]
income[RW]
other_expenses[RW]
other_income[RW]

Public Class Methods

new(json: {}) click to toggle source
Calls superclass method Codat::BaseModel::new
# File lib/codat/models/profit_and_loss_report.rb, line 15
def initialize(json: {})
  super

  @from_date = Date.parse(json.fetch(:fromDate))
  @to_date = Date.parse(json.fetch(:toDate))

  @income = ReportItem.new(json: json.fetch(:income, {}))
  @cost_of_sales = ReportItem.new(json: json.fetch(:costOfSales, {}))
  @expenses = ReportItem.new(json: json.fetch(:expenses, {}))
  @other_expenses = ReportItem.new(json: json.fetch(:otherExpenses, {}))
  @other_income = ReportItem.new(json: json.fetch(:otherIncome, {}))
end