Class: Invoicer::FreshbooksInvoiceManager

Inherits:
Object
  • Object
show all
Defined in:
lib/services/freshbooks/invoice_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service) ⇒ FreshbooksInvoiceManager

Returns a new instance of FreshbooksInvoiceManager.



7
8
9
# File 'lib/services/freshbooks/invoice_manager.rb', line 7

def initialize(service)
  @service = service
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



5
6
7
# File 'lib/services/freshbooks/invoice_manager.rb', line 5

def service
  @service
end

Instance Method Details

#allObject



11
12
13
14
15
# File 'lib/services/freshbooks/invoice_manager.rb', line 11

def all
  service.freshbooks.invoice.list["invoices"]["invoice"].map do |i|
    Invoicer::FreshbooksInvoice.from_freshbooks(i)
  end
end

#get(id) ⇒ Object



17
18
19
20
# File 'lib/services/freshbooks/invoice_manager.rb', line 17

def get(id)
  hash = service.freshbooks.invoice.get(:invoice_id => id)["invoice"]
  Invoicer::FreshbooksInvoice.from_freshbooks(hash)
end