Class: Harvesting::Models::Invoice

Inherits:
HarvestRecord show all
Defined in:
lib/harvesting/models/invoice.rb

Overview

An invoice record from your Harvest account.

For more information: help.getharvest.com/api-v2/invoices-api/invoices/invoices/

Instance Attribute Summary

Attributes inherited from Base

#attributes, #harvest_client

Instance Method Summary collapse

Methods inherited from HarvestRecord

#create, #save, #update

Methods inherited from Base

#create, #delete, #fetch, get, #initialize, #save, #to_hash, #update

Constructor Details

This class inherits a constructor from Harvesting::Models::Base

Instance Method Details

#line_itemsObject



35
36
37
# File 'lib/harvesting/models/invoice.rb', line 35

def line_items
  @line_items ||= @attributes['line_items'].map { |line_item_attributes| LineItem.new line_item_attributes, { harvest_client: harvest_client } }
end

#pathObject



39
40
41
# File 'lib/harvesting/models/invoice.rb', line 39

def path
  @attributes['id'].nil? ? "invoices" : "invoices/#{@attributes['id']}"
end