vindi 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,95 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the bills API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/bills
6
+ module Bill
7
+
8
+ # List bill for the authenticate user
9
+ # @return [Array<Hash>] A list of bills for a merchant.
10
+ # @example Get all bills from merchant vindi
11
+ def list_bills(options = {})
12
+ get('bills', options)[:bills]
13
+ end
14
+
15
+ # Get a single bill from a merchant
16
+ #
17
+ # @param bill_id [Integer] ID of the bill
18
+ # @return [Hash] The bill you requested, if it exists
19
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/GET_version_bills_id_format
20
+ # @example Get bill #2 from vindi
21
+ # client.bill(2)
22
+ def bill(bill_id, options = {})
23
+ get("bills/#{bill_id}", options)[:bill]
24
+ end
25
+
26
+ # Create a bill for a merchant vindi
27
+ #
28
+ # @option options [Hash] :options bill attributes
29
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/POST_version_bills_format
30
+ # @return [Hash] The bill created
31
+ # @example Create a bill for a merchant vindi
32
+ # client.create_bill(customer_id: 2, payment_method_code: "credit_card",
33
+ # bill_items: [{ product_id: 26, amount: 1 }])
34
+ def create_bill(options = {})
35
+ post('bills', options)[:bill]
36
+ end
37
+
38
+ # Edit a bill
39
+ #
40
+ # @params bill_id [Integer] ID of the bill
41
+ # @option options [Hash] :options bill attributes
42
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/PUT_version_bills_id_format
43
+ # @example update bill #2
44
+ # client.update_bill(2, payment_method_code: "debit_card")
45
+ def update_bill(bill_id, options = {})
46
+ put("bills/#{bill_id}", options)[:bill]
47
+ end
48
+
49
+ # Approve a bill
50
+ #
51
+ # @params bill_id [Integer] ID of the bill
52
+ # @option options [Hash] :options bill attributes
53
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/PUT_version_bills_id_format
54
+ # @example approve bill #2
55
+ # client.approve_bill(2)
56
+ def approve_bill(bill_id, options = {})
57
+ post("bills/#{bill_id}/approve", options)[:bill]
58
+ end
59
+
60
+ # Charge a bill
61
+ #
62
+ # @params bill_id [Integer] ID of the bill
63
+ # @option options [Hash] :options bill attributes
64
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/PUT_version_bills_id_format
65
+ # @example charge bill #2
66
+ # client.charge_bill(2)
67
+ def charge_bill(bill_id, options = {})
68
+ post("bills/#{bill_id}/charge", options)[:bill]
69
+ end
70
+
71
+ # Generate invoice from a bill
72
+ #
73
+ # @params bill_id [Integer] ID of the bill
74
+ # @option options [Hash] :options bill attributes
75
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/PUT_version_bills_id_format
76
+ # @example create a invoice from bill #2
77
+ # client.create_invoice_from_bill(2)
78
+ def create_invoice_from_bill(bill_id, options = {})
79
+ post("bills/#{bill_id}/invoice", options)[:invoices]
80
+ end
81
+
82
+ # Delete a bill from merchant vindi
83
+ #
84
+ # @params bill_id [Integer] ID of the bill
85
+ # @option options [Hash] :options bill attributes
86
+ #
87
+ # @see https://vindi.github.io/api-docs/dist/#!/bills/DELETE_version_bills_id_format
88
+ # @example Delete bill #2
89
+ # client.delete_bill(2)
90
+ def delete_bill(bill_id, options = {})
91
+ delete("bills/#{bill_id}", options)[:bill]
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,20 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the bill_items API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/bill_items
6
+ module BillItem
7
+
8
+ # Get a single bill_item from a merchant
9
+ #
10
+ # @param bill_item_id [Integer] ID of the bill_item
11
+ # @return [Hash] The bill_item you requested, if it exists
12
+ # @see https://vindi.github.io/api-docs/dist/#!/bill_items/GET_version_bill_items_id_format
13
+ # @example Get bill_item #2 from vindi
14
+ # client.bill_item(2)
15
+ def bill_item(bill_item_id, options = {})
16
+ get("bill_items/#{bill_item_id}", options)[:bill_item]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,94 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the charges API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/charges
6
+ module Charge
7
+
8
+ # List charge for the authenticate user
9
+ # @return [Array<Hash>] A list of charges for a merchant.
10
+ # @example Get all charges from merchant vindi
11
+ def list_charges(options = {})
12
+ get('charges', options)[:charges]
13
+ end
14
+
15
+ # Get a single charge from a merchant
16
+ #
17
+ # @param charge_id [Integer] ID of the charge
18
+ # @return [Hash] The charge you requested, if it exists
19
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/GET_version_charges_id_format
20
+ # @example Get charge #2 from vindi
21
+ # client.charge(2)
22
+ def charge(charge_id, options = {})
23
+ get("charges/#{charge_id}", options)[:charge]
24
+ end
25
+
26
+ # Edit a charge
27
+ #
28
+ # @params charge_id [Integer] ID of the charge
29
+ # @option options [Hash] :options charge attributes
30
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/PUT_version_charges_id_format
31
+ # @example update charge #2
32
+ # client.update_charge(2, installments: 3)
33
+ def update_charge(charge_id, options = {})
34
+ put("charges/#{charge_id}", options)[:charge]
35
+ end
36
+
37
+ # Reissue a charge
38
+ #
39
+ # @params charge_id [Integer] ID of the charge
40
+ # @option options [Hash] :options charge attributes
41
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/PUT_version_charges_id_format
42
+ # @example reissue charge #2
43
+ # client.reissue_charge(2, payment_method_code: 'debit_card')
44
+ def reissue_charge(charge_id, options = {})
45
+ post("charges/#{charge_id}/reissue", options)[:charge]
46
+ end
47
+
48
+ # Perform a charge
49
+ #
50
+ # @params charge_id [Integer] ID of the charge
51
+ # @option options [Hash] :options charge attributes
52
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/PUT_version_charges_id_format
53
+ # @example perform a charge #2
54
+ # client.perform_charge(2)
55
+ def perform_charge(charge_id, options = {})
56
+ post("charges/#{charge_id}/charge", options)[:charge]
57
+ end
58
+
59
+ # Refund from a charge
60
+ #
61
+ # @params charge_id [Integer] ID of the charge
62
+ # @option options [Hash] :options charge attributes
63
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/PUT_version_charges_id_format
64
+ # @example refund from charge #2
65
+ # client.refund_charge(2, amount: 50)
66
+ def refund_charge(charge_id, options = {})
67
+ post("charges/#{charge_id}/refund", options)[:charge]
68
+ end
69
+
70
+ # Perform fraud review
71
+ #
72
+ # @params charge_id [Integer] ID of the charge
73
+ # @option options [Hash] :options charge attributes
74
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/PUT_version_charges_id_format
75
+ # @example perform a fraud review charge #2
76
+ # client.fraud_review_charge(2)
77
+ def fraud_review(charge_id, options = {})
78
+ post("charges/#{charge_id}/fraud_review", options)[:charge]
79
+ end
80
+
81
+ # Delete a charge from merchant vindi
82
+ #
83
+ # @params charge_id [Integer] ID of the charge
84
+ # @option options [Hash] :options charge attributes
85
+ #
86
+ # @see https://vindi.github.io/api-docs/dist/#!/charges/DELETE_version_charges_id_format
87
+ # @example Delete charge #2
88
+ # client.delete_charge(2)
89
+ def delete_charge(charge_id, options = {})
90
+ delete("charges/#{charge_id}", options)[:charge]
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,61 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the Customers API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/customers
6
+ module Customer
7
+
8
+ # List customer for the authenticate user
9
+ # @return [Array<Hash>] A list of customers for a merchant.
10
+ # @example Get all customers from merchant vindi
11
+ def list_customers(options = {})
12
+ get('customers', options)[:customers]
13
+ end
14
+
15
+ # Get a single customer from a merchant
16
+ #
17
+ # @param customer_id [Integer] ID of the customer
18
+ # @return [Hash] The customer you requested, if it exists
19
+ # @see https://vindi.github.io/api-docs/dist/#!/customers/GET_version_customers_id_format
20
+ # @example Get customer #2 from vindi
21
+ # client.customer(2)
22
+ def customer(customer_id, options = {})
23
+ get("customers/#{customer_id}", options)[:customer]
24
+ end
25
+
26
+ # Create a customer for a merchant vindi
27
+ #
28
+ # @option options [Hash] :options customer attributes
29
+ # @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_format
30
+ # @return [Hash] The customer created
31
+ # @example Create a customer for a merchant vindi
32
+ # client.create_customer(name: 'John Doe', email: 'john.doe@mail.com')
33
+ def create_customer(options = {})
34
+ post('customers', options)[:customer]
35
+ end
36
+
37
+ # Edit a customer
38
+ #
39
+ # @params customer_id [Integer] ID of the customer
40
+ # @option options [Hash] :options customer attributes
41
+ # @see https://vindi.github.io/api-docs/dist/#!/customers/PUT_version_customers_id_format
42
+ # @example update customer #2
43
+ # client.update_customer(2, name: 'Joana Doe', email: 'johanadoes@mail.com')
44
+ def update_customer(customer_id, options = {})
45
+ put("customers/#{customer_id}", options)[:customer]
46
+ end
47
+
48
+ # Delete a customer from merchant vindi
49
+ #
50
+ # @params customer_id [Integer] ID of the customer
51
+ # @option options [Hash] :options customer attributes
52
+ #
53
+ # @see https://vindi.github.io/api-docs/dist/#!/customers/DELETE_version_customers_id_format
54
+ # @example Delete customer #2
55
+ # client.delete_customer(2)
56
+ def delete_customer(customer_id, options = {})
57
+ delete("customers/#{customer_id}", options)[:customer]
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,45 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the discount API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/discounts
6
+ module Discount
7
+
8
+ # Get a single discount from a merchant
9
+ #
10
+ # @param discount_id [Integer] ID of the discount
11
+ # @return [Hash] The discount you requested, if it exists
12
+ # @see https://vindi.github.io/api-docs/dist/#!/discounts/GET_version_discounts_id_format
13
+ # @example Get discount #2 from vindi
14
+ # client.discount(2)
15
+ def discount(discount_id, options = {})
16
+ get("discounts/#{discount_id}", options)[:discount]
17
+ end
18
+
19
+ # Create a discount for a merchant vindi
20
+ #
21
+ # @option options [Hash] :options discount attributes
22
+ # @see https://vindi.github.io/api-docs/dist/#!/discounts/POST_version_discounts_format
23
+ # @return [Hash] The discount created
24
+ # @example Create a discount for a merchant vindi
25
+ # client.create_discount(product_item_id: 118,
26
+ # discount_type: "percentage", percentage: 10,
27
+ # amount: 1, quantity: 1, cycles: 1)
28
+ def create_discount(options = {})
29
+ post('discounts', options)[:discount]
30
+ end
31
+
32
+ # Delete a discount from merchant vindi
33
+ #
34
+ # @params discount_id [Integer] ID of the discount
35
+ # @option options [Hash] :options discount attributes
36
+ #
37
+ # @see https://vindi.github.io/api-docs/dist/#!/discounts/DELETE_version_discounts_id_format
38
+ # @example Delete discount #2
39
+ # client.delete_discount(2)
40
+ def delete_discount(discount_id, options = {})
41
+ delete("discounts/#{discount_id}", options)[:discount]
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,38 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the Import Batch API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/import_batches
6
+ module ImportBatch
7
+
8
+ # List import_batchs for the authenticate user
9
+ # @option options [Integer] :page (1) Page number.
10
+ # @option options [Integer] :merchant Merchant account
11
+ # @return [Array<Hash>] A list of imported batches for a merchant.
12
+ # @example Get all import_batches from merchant vindi
13
+ def list_import_batches(options = {})
14
+ get('import_batches', options)[:import_batches]
15
+ end
16
+
17
+ # Get a single import_batch from a merchant
18
+ #
19
+ # @param import_batch_id [Integer] ID of the import_batch
20
+ # @return [Hash] The import_batch you requested, if it exists
21
+ # @see https://vindi.github.io/api-docs/dist/#!/import_batches/GET_version_import_batches_id_format
22
+ # @example Get import_batch #2 from vindi
23
+ # client.import_batch(2)
24
+ def import_batch(import_batch_id, options = {})
25
+ get("import_batches/#{import_batch_id}", options)[:import_batch]
26
+ end
27
+
28
+ # Create a import_batch for a merchant vindi
29
+ #
30
+ # @option options [Hash] :options import_batch attributes
31
+ # @see https://vindi.github.io/api-docs/dist/#!/import_batches/POST_version_import_batches_format
32
+ # @return [Hash] The import_batch created
33
+ def create_import_batch(options = {})
34
+ post('import_batches', options)[:import_batch]
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,50 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the invoices API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/invoices
6
+ module Invoice
7
+
8
+ # List invoice for the authenticate user
9
+ # @return [Array<Hash>] A list of invoices for a merchant.
10
+ # @example Get all invoices from merchant vindi
11
+ def list_invoices(options = {})
12
+ get('invoices', options)[:invoices]
13
+ end
14
+
15
+ # Get a single invoice from a merchant
16
+ #
17
+ # @param invoice_id [Integer] ID of the invoice
18
+ # @return [Hash] The invoice you requested, if it exists
19
+ # @see https://vindi.github.io/api-docs/dist/#!/invoices/GET_version_invoices_id_format
20
+ # @example Get invoice #108 from vindi
21
+ # client.invoice(108)
22
+ def invoice(invoice_id, options = {})
23
+ get("invoices/#{invoice_id}", options)[:invoice]
24
+ end
25
+
26
+ # Create a invoice for a merchant vindi
27
+ #
28
+ # @option options [Hash] :options invoice attributes
29
+ # @see https://vindi.github.io/api-docs/dist/#!/invoices/POST_version_invoices_format
30
+ # @return [Hash] The invoice created
31
+ # @example Create a invoice for a merchant vindi
32
+ # client.create_invoice({ bill_id: 71, amount: 1 })
33
+ def create_invoice(options = {})
34
+ post('invoices', options)[:invoice]
35
+ end
36
+
37
+ # Delete a invoice from merchant vindi
38
+ #
39
+ # @params invoice_id [Integer] ID of the invoice
40
+ # @option options [Hash] :options invoice attributes
41
+ #
42
+ # @see https://vindi.github.io/api-docs/dist/#!/invoices/DELETE_version_invoices_id_format
43
+ # @example Delete invoice #108
44
+ # client.delete_invoice(108)
45
+ def delete_invoice(invoice_id, options = {})
46
+ delete("invoices/#{invoice_id}", options)[:invoice]
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,40 @@
1
+ module Vindi
2
+ module Rest
3
+
4
+ # Methods for the issues API
5
+ # @see https://vindi.github.io/api-docs/dist/#!/issues
6
+ module Issue
7
+
8
+ # List issues for the authenticate user
9
+ # @option options [Integer] :page (1) Page number.
10
+ # @option options [Integer] :merchant Merchant account
11
+ # @return [Array<Hash>] A list of issues for a merchant.
12
+ # @example Get all issues from merchant vindi
13
+ def list_issues(options = {})
14
+ get('issues', options)[:issues]
15
+ end
16
+
17
+ # Get a single issue from a merchant
18
+ #
19
+ # @param issue_id [Integer] ID of the issue
20
+ # @return [Hash] The issue you requested, if it exists
21
+ # @see https://vindi.github.io/api-docs/dist/#!/issues/GET_version_issues_id_format
22
+ # @example Get issue #154 from vindi
23
+ # client.issue(2)
24
+ def issue(issue_id, options = {})
25
+ get("issues/#{issue_id}", options)[:issue]
26
+ end
27
+
28
+ # Edit a issue
29
+ #
30
+ # @params issue_id [Integer] ID of the issue
31
+ # @option options [Hash] :options issue attributes
32
+ # @see https://vindi.github.io/api-docs/dist/#!/issues/PUT_version_issues_id_format
33
+ # @example update issue #2
34
+ # client.update_issue(2, status: "open")
35
+ def update_issue(issue_id, options = {})
36
+ put("issues/#{issue_id}", options)[:issue]
37
+ end
38
+ end
39
+ end
40
+ end