Method: Invoicexpress::Client::Clients#client_create_invoice

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

#client_create_invoice(client_id, invoice, options = {}) ⇒ Invoicexpress::Models::Invoice

This method allows you to create a new invoice for a specific client. When creating the invoice:

  • If items do not exist with the given names, new ones will be created.

  • If item name already exists, the item is updated with the new values.

Regarding item taxes, if the tax name is not found, no tax is applied to that item.

Parameters:

  • client_id (String)

    The ID of the client

Returns:

Raises:

  • Invoicexpress::Unauthorized When the client is unauthorized

  • Invoicexpress::UnprocessableEntity When there are errors on the submission

  • Invoicexpress::NotFound When there are no clients with that name



136
137
138
139
140
141
142
143
144
145
# File 'lib/invoicexpress/client/clients.rb', line 136

def client_create_invoice(client_id, invoice, options={})
  raise(ArgumentError, "invoice has the wrong type") unless invoice.is_a?(Invoicexpress::Models::Invoice)

  params = {
    :klass => Invoicexpress::Models::Invoice,
    :body  => invoice
  }

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