Module: Vindi::Rest::Bill

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

Overview

Methods for the bills API

Instance Method Summary collapse

Instance Method Details

#approve_bill(bill_id, options = {}) ⇒ Object

Approve a bill

Examples:

approve bill #2

client.approve_bill(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

See Also:



56
57
58
# File 'lib/vindi/rest/bill.rb', line 56

def approve_bill(bill_id, options = {})
  post("bills/#{bill_id}/approve", options)[:bill]
end

#bill(bill_id, options = {}) ⇒ Hash

Get a single bill from a merchant

Examples:

Get bill #2 from vindi

client.bill(2)

Parameters:

  • bill_id (Integer)

    ID of the bill

Returns:

  • (Hash)

    The bill you requested, if it exists

See Also:



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

def bill(bill_id, options = {})
  get("bills/#{bill_id}", options)[:bill]
end

#charge_bill(bill_id, options = {}) ⇒ Object

Charge a bill

Examples:

charge bill #2

client.charge_bill(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

See Also:



67
68
69
# File 'lib/vindi/rest/bill.rb', line 67

def charge_bill(bill_id, options = {})
  post("bills/#{bill_id}/charge", options)[:bill]
end

#create_bill(options = {}) ⇒ Hash

Create a bill for a merchant vindi

Examples:

Create a bill for a merchant vindi

client.create_bill(customer_id: 2, payment_method_code: "credit_card",
                   bill_items: [{ product_id: 26, amount: 1 }])

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

Returns:

  • (Hash)

    The bill created

See Also:



34
35
36
# File 'lib/vindi/rest/bill.rb', line 34

def create_bill(options = {})
  post('bills', options)[:bill]
end

#create_invoice_from_bill(bill_id, options = {}) ⇒ Object

Generate invoice from a bill

Examples:

create a invoice from bill #2

client.create_invoice_from_bill(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

See Also:



78
79
80
# File 'lib/vindi/rest/bill.rb', line 78

def create_invoice_from_bill(bill_id, options = {})
  post("bills/#{bill_id}/invoice", options)[:invoices]
end

#delete_bill(bill_id, options = {}) ⇒ Object

Delete a bill from merchant vindi

Examples:

Delete bill #2

client.delete_bill(2)

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

See Also:



90
91
92
# File 'lib/vindi/rest/bill.rb', line 90

def delete_bill(bill_id, options = {})
  delete("bills/#{bill_id}", options)[:bill]
end

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

List bill for the authenticate user

Examples:

Get all bills from merchant vindi

Returns:

  • (Array<Hash>)

    A list of bills for a merchant.



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

def list_bills(options = {})
  get('bills', options)[:bills]
end

#update_bill(bill_id, options = {}) ⇒ Object

Edit a bill

Examples:

update bill #2

client.update_bill(2, payment_method_code: "debit_card")

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    bill attributes

See Also:



45
46
47
# File 'lib/vindi/rest/bill.rb', line 45

def update_bill(bill_id, options = {})
  put("bills/#{bill_id}", options)[:bill]
end