Class: Codat::Models::ProfitAndLossReport

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/codat/models/profit_and_loss_report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

attributes, #format_url, format_url, get, #get, post, #post, successful_response?

Constructor Details

#initialize(json: {}) ⇒ ProfitAndLossReport

Returns a new instance of ProfitAndLossReport.



15
16
17
18
19
20
21
22
23
24
25
26
# 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

Instance Attribute Details

#cost_of_salesObject

Returns the value of attribute cost_of_sales.



13
14
15
# File 'lib/codat/models/profit_and_loss_report.rb', line 13

def cost_of_sales
  @cost_of_sales
end

#expensesObject

Returns the value of attribute expenses.



13
14
15
# File 'lib/codat/models/profit_and_loss_report.rb', line 13

def expenses
  @expenses
end

#incomeObject

Returns the value of attribute income.



13
14
15
# File 'lib/codat/models/profit_and_loss_report.rb', line 13

def income
  @income
end

#other_expensesObject

Returns the value of attribute other_expenses.



13
14
15
# File 'lib/codat/models/profit_and_loss_report.rb', line 13

def other_expenses
  @other_expenses
end

#other_incomeObject

Returns the value of attribute other_income.



13
14
15
# File 'lib/codat/models/profit_and_loss_report.rb', line 13

def other_income
  @other_income
end