Module: Vindi::Rest::Invoice

Included in:
Vindi::Rest
Defined in:
lib/vindi/rest/invoice.rb

Overview

Methods for the invoices API

Instance Method Summary collapse

Instance Method Details

#create_invoice(options = {}) ⇒ Hash

Create a invoice for a merchant vindi

Examples:

Create a invoice for a merchant vindi

client.create_invoice({ bill_id: 71, amount: 1 })

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    invoice attributes

Returns:

  • (Hash)

    The invoice created

See Also:



33
34
35
# File 'lib/vindi/rest/invoice.rb', line 33

def create_invoice(options = {})
  post('invoices', options)[:invoice]
end

#delete_invoice(invoice_id, options = {}) ⇒ Object

Delete a invoice from merchant vindi

Examples:

Delete invoice #108

client.delete_invoice(108)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    invoice attributes

See Also:



44
45
46
# File 'lib/vindi/rest/invoice.rb', line 44

def delete_invoice(invoice_id, options = {})
  delete("invoices/#{invoice_id}", options)[:invoice]
end

#invoice(invoice_id, options = {}) ⇒ Hash

Get a single invoice from a merchant

Examples:

Get invoice #108 from vindi

client.invoice(108)

Parameters:

  • invoice_id (Integer)

    ID of the invoice

Returns:

  • (Hash)

    The invoice you requested, if it exists

See Also:



22
23
24
# File 'lib/vindi/rest/invoice.rb', line 22

def invoice(invoice_id, options = {})
  get("invoices/#{invoice_id}", options)[:invoice]
end

#list_invoices(options = {}) ⇒ Array<Hash>

List invoice for the authenticate user

Examples:

Get all invoices from merchant vindi

Returns:

  • (Array<Hash>)

    A list of invoices for a merchant.



11
12
13
# File 'lib/vindi/rest/invoice.rb', line 11

def list_invoices(options = {})
  get('invoices', options)[:invoices]
end

#retry_invoice(invoice_id, options = {}) ⇒ Object

Retry a invoice from merchant vindi

Examples:

Retry a invoice from merchant vindi

client.retry_invoice(108)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    invoice attributes

See Also:



55
56
57
# File 'lib/vindi/rest/invoice.rb', line 55

def retry_invoice(invoice_id, options = {})
  post("invoices/#{invoice_id}/retry", options)[:invoice]
end