Class: ZohoInvoiceResource::Invoice

Inherits:
Base
  • Object
show all
Defined in:
lib/zoho_invoice_resource/invoice.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

cached_resource, collection_path, connection, #create_resource_for, element_path, #encode, find_all_recursively, #update, #update_element_path

Methods included from UnderscoreKeys

#load

Class Method Details

.formatObject

schema do

integer :invoice_id

end



10
11
12
# File 'lib/zoho_invoice_resource/invoice.rb', line 10

def self.format
  self._format ||= Formats::Invoice.new
end

Instance Method Details

#invoice_items_attributes=(attributes_collection) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/zoho_invoice_resource/invoice.rb', line 14

def invoice_items_attributes=(attributes_collection)
  attributes_collection.each do |attributes|
    attributes = attributes.with_indifferent_access
    if existing_item = self.invoice_items.find{|item| item.item_id == attributes[:item_id]}
      existing_item.assign_attributes(attributes)
    else
      # TODO: raise error
    end
  end
end