Method: Invoicexpress::Client::Clients#client_invoices

Defined in:
lib/invoicexpress/client/clients.rb

#client_invoices(client_id, filter = Invoicexpress::Models::Filter.new, options = {}) ⇒ Invoicexpress::Models::ClientInvoices

This method allows you to obtain the invoices for a specific client. Allowing filtering aswell.

Parameters:

  • client_id (String)

    The client’s ID

  • filter (Invoicexpress::Models::Filter) (defaults to: Invoicexpress::Models::Filter.new)

    An optional filter

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • per_page (Integer) — default: 10

    You can specify how many results you want to fetch

  • page (Integer) — default: 1

    You can ask a specific page of clients

Returns:

Raises:

  • Invoicexpress::Unauthorized When the client is unauthorized

  • Invoicexpress::NotFound When the client ID is not found



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/invoicexpress/client/clients.rb', line 82

def client_invoices(client_id, filter=Invoicexpress::Models::Filter.new, options={})
  raise(ArgumentError, "filter has the wrong type") unless filter.is_a?(Invoicexpress::Models::Filter)

  params = {
    :klass    => Invoicexpress::Models::ClientInvoices,
    :per_page => 10,
    :page     => 1,
    :body     => filter
  }

  post("clients/#{client_id.to_s}/invoices.xml", params.merge(options))
end