vindi 0.0.4 → 0.0.9
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.
- checksums.yaml +4 -4
- data/lib/vindi/response/raise_error.rb +1 -3
- data/lib/vindi/rest.rb +1 -0
- data/lib/vindi/rest/charge.rb +15 -1
- data/lib/vindi/rest/customer.rb +16 -3
- data/lib/vindi/rest/export_batch.rb +52 -0
- data/lib/vindi/rest/import_batch.rb +1 -1
- data/lib/vindi/rest/invoice.rb +11 -1
- data/lib/vindi/rest/period.rb +12 -0
- data/lib/vindi/rest/subscription.rb +10 -0
- data/lib/vindi/version.rb +1 -1
- data/vindi.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0941399870c32f8ef9cc2216599767dec3f9ebdf09ed4aa3ca3e4b6156656da2'
|
4
|
+
data.tar.gz: a563c86024c4a2fcf8f01a1776ed6637a1aa378520450e0600ff3ba6662ac566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06550cdb5db7c44abfbf035f65d2112d3f5dcf3100080574c7fc67f70e9f2ed1887642d681e96101605f4ada4dc052450b472787e6595029506b19f8366d8c40
|
7
|
+
data.tar.gz: c2cb29b5604ac5fcab230692546dc77eddc9d29ad58779f52ea26bebb2b66dc78f09923b5392b569234e68f54c3e55f0ab68007d236466e2c678dfa5dff45644
|
@@ -7,10 +7,8 @@ module Vindi
|
|
7
7
|
# This class raises exceptions based HTTP status codes retuned by the API
|
8
8
|
class RaiseError < Faraday::Response::Middleware
|
9
9
|
|
10
|
-
private
|
11
|
-
|
12
10
|
def on_complete(response)
|
13
|
-
|
11
|
+
error = Vindi::Error.from_response(response)
|
14
12
|
raise error if error
|
15
13
|
end
|
16
14
|
end
|
data/lib/vindi/rest.rb
CHANGED
data/lib/vindi/rest/charge.rb
CHANGED
@@ -11,7 +11,8 @@ module Vindi
|
|
11
11
|
def list_charges(options = {})
|
12
12
|
get('charges', options)[:charges]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
|
+
|
15
16
|
# Get a single charge from a merchant
|
16
17
|
#
|
17
18
|
# @param charge_id [Integer] ID of the charge
|
@@ -89,6 +90,19 @@ module Vindi
|
|
89
90
|
def delete_charge(charge_id, options = {})
|
90
91
|
delete("charges/#{charge_id}", options)[:charge]
|
91
92
|
end
|
93
|
+
|
94
|
+
|
95
|
+
# Capture a charge from merchant vindi
|
96
|
+
#
|
97
|
+
# @params charge_id [Integer] ID of the charge
|
98
|
+
# @option options [Hash] :options charge attributes
|
99
|
+
#
|
100
|
+
# @see https://vindi.github.io/api-docs/dist/#!/charges/POST_version_charges_id_capture_format
|
101
|
+
# @example Capture charge #2
|
102
|
+
# client.capture_charge(2)
|
103
|
+
def capture_charge(charge_id, options = {})
|
104
|
+
post("charges/#{charge_id}/capture", options)[:charge]
|
105
|
+
end
|
92
106
|
end
|
93
107
|
end
|
94
108
|
end
|
data/lib/vindi/rest/customer.rb
CHANGED
@@ -11,7 +11,7 @@ module Vindi
|
|
11
11
|
def list_customers(options = {})
|
12
12
|
get('customers', options)[:customers]
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
# Get a single customer from a merchant
|
16
16
|
#
|
17
17
|
# @param customer_id [Integer] ID of the customer
|
@@ -24,9 +24,9 @@ module Vindi
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Create a customer for a merchant vindi
|
27
|
-
#
|
27
|
+
#
|
28
28
|
# @option options [Hash] :options customer attributes
|
29
|
-
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_format
|
29
|
+
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_format
|
30
30
|
# @return [Hash] The customer created
|
31
31
|
# @example Create a customer for a merchant vindi
|
32
32
|
# client.create_customer(name: 'John Doe', email: 'john.doe@mail.com')
|
@@ -56,6 +56,19 @@ module Vindi
|
|
56
56
|
def delete_customer(customer_id, options = {})
|
57
57
|
delete("customers/#{customer_id}", options)[:customer]
|
58
58
|
end
|
59
|
+
|
60
|
+
|
61
|
+
# Unarchive a customer from merchant vindi
|
62
|
+
#
|
63
|
+
# @params customer_id [Integer] ID of the customer
|
64
|
+
# @option options [Hash] :options customer attributes
|
65
|
+
#
|
66
|
+
# @see https://vindi.github.io/api-docs/dist/#!/customers/POST_version_customers_id_unarchive_format
|
67
|
+
# @example Unarchive customer #2
|
68
|
+
# client.unarchive_customer(2)
|
69
|
+
def unarchive_customer(customer_id, options = {})
|
70
|
+
post("customers/#{customer_id}/unarchive", options)[:customer]
|
71
|
+
end
|
59
72
|
end
|
60
73
|
end
|
61
74
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Vindi
|
2
|
+
module Rest
|
3
|
+
|
4
|
+
# Methods for the export_batches API
|
5
|
+
# @see https://vindi.github.io/api-docs/dist/#!/export_batches
|
6
|
+
module ExportBatch
|
7
|
+
|
8
|
+
# List export batches 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 export batches for a merchant.
|
12
|
+
# @example Get all export batches from merchant vindi
|
13
|
+
def list_export_batches(options = {})
|
14
|
+
get('export_batches', options)[:export_batches]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a single export batch from a merchant
|
18
|
+
#
|
19
|
+
# @param export_batch_id [Integer] ID of the export batch
|
20
|
+
# @return [Hash] The export batch you requested, if it exists
|
21
|
+
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/GET_version_export_batches_id_format
|
22
|
+
# @example Get export batch #154 from vindi
|
23
|
+
# client.export_batch(154)
|
24
|
+
def export_batch(export_batch_id, options = {})
|
25
|
+
get("export_batches/#{export_batch_id}", options)[:export_batch]
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create an export batch for a merchant vindi
|
29
|
+
#
|
30
|
+
# @option options [Hash] :options export_batch attributes
|
31
|
+
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/POST_version_export_batches_format
|
32
|
+
# @return [Hash] The export batch created
|
33
|
+
# @example Create an export batch for a merchant vindi
|
34
|
+
# client.create_export_batch({ "payment_method_code": 2, "payment_company_code": "itau" })
|
35
|
+
def create_export_batch(options = {})
|
36
|
+
post('export_batches', options)[:export_batch]
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# Approve an export batch for a merchant vindi
|
41
|
+
#
|
42
|
+
# @option options [Hash] :options export_batch attributes
|
43
|
+
# @see https://vindi.github.io/api-docs/dist/#!/export_batches/POST_version_export_batches_id_approve_format
|
44
|
+
# @return [Hash] The export batch approved
|
45
|
+
# @example Approve an export batch for a merchant vindi
|
46
|
+
# client.approve_export_batch(2)
|
47
|
+
def approve_export_batch(export_batch_id, options = {})
|
48
|
+
post("export_batches/#{export_batch_id}/approve", options)[:export_batch]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -5,7 +5,7 @@ module Vindi
|
|
5
5
|
# @see https://vindi.github.io/api-docs/dist/#!/import_batches
|
6
6
|
module ImportBatch
|
7
7
|
|
8
|
-
# List
|
8
|
+
# List import_batches for the authenticate user
|
9
9
|
# @option options [Integer] :page (1) Page number.
|
10
10
|
# @option options [Integer] :merchant Merchant account
|
11
11
|
# @return [Array<Hash>] A list of imported batches for a merchant.
|
data/lib/vindi/rest/invoice.rb
CHANGED
@@ -38,13 +38,23 @@ module Vindi
|
|
38
38
|
#
|
39
39
|
# @params invoice_id [Integer] ID of the invoice
|
40
40
|
# @option options [Hash] :options invoice attributes
|
41
|
-
#
|
42
41
|
# @see https://vindi.github.io/api-docs/dist/#!/invoices/DELETE_version_invoices_id_format
|
43
42
|
# @example Delete invoice #108
|
44
43
|
# client.delete_invoice(108)
|
45
44
|
def delete_invoice(invoice_id, options = {})
|
46
45
|
delete("invoices/#{invoice_id}", options)[:invoice]
|
47
46
|
end
|
47
|
+
|
48
|
+
# Retry a invoice from merchant vindi
|
49
|
+
#
|
50
|
+
# @params invoice_id [Integer] ID of the invoice
|
51
|
+
# @option options [Hash] :options invoice attributes
|
52
|
+
# @see https://vindi.github.io/api-docs/dist/#/invoices/postV1InvoicesIdRetry
|
53
|
+
# @example Retry a invoice from merchant vindi
|
54
|
+
# client.retry_invoice(108)
|
55
|
+
def retry_invoice(invoice_id, options = {})
|
56
|
+
post("invoices/#{invoice_id}/retry", options)[:invoice]
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
end
|
data/lib/vindi/rest/period.rb
CHANGED
@@ -47,6 +47,18 @@ module Vindi
|
|
47
47
|
def update_period(period_id, options = {})
|
48
48
|
put("periods/#{period_id}", options)[:period]
|
49
49
|
end
|
50
|
+
|
51
|
+
# List period usages
|
52
|
+
#
|
53
|
+
# @params period_id [Integer] ID of the period
|
54
|
+
# @option options [Integer] :page (1) Page number.
|
55
|
+
# @return [Array<Hash>] A list of usages for a period.
|
56
|
+
# @see https://vindi.github.io/api-docs/dist/#/periods/getV1PeriodsIdUsages
|
57
|
+
# @example List period usages
|
58
|
+
# client.list_period_usages(2)
|
59
|
+
def list_period_usages(period_id, options = {})
|
60
|
+
get("periods/#{period_id}/usages", options)[:usages]
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
52
64
|
end
|
@@ -80,6 +80,16 @@ module Vindi
|
|
80
80
|
def delete_subscription(subscription_id, options = {})
|
81
81
|
delete("subscriptions/#{subscription_id}", options)[:subscription]
|
82
82
|
end
|
83
|
+
|
84
|
+
# List product items for a subscription
|
85
|
+
#
|
86
|
+
# @params subscription_id
|
87
|
+
# @see https://vindi.github.io/api-docs/dist/#!/subscriptions/GET_version_subscriptions_id_product_items_format
|
88
|
+
# @example List subscription product items #2
|
89
|
+
# client.list_subscription_product_items(2)
|
90
|
+
def list_subscription_product_items(subscription_id, options = {})
|
91
|
+
get("subscriptions/#{subscription_id}/product_items", options)[:product_items]
|
92
|
+
end
|
83
93
|
end
|
84
94
|
end
|
85
95
|
end
|
data/lib/vindi/version.rb
CHANGED
data/vindi.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
18
|
|
19
|
-
spec.add_dependency 'faraday', '~>
|
19
|
+
spec.add_dependency 'faraday', '~> 1'
|
20
20
|
spec.add_development_dependency "bundler"
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vindi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/vindi/rest/charge.rb
|
75
75
|
- lib/vindi/rest/customer.rb
|
76
76
|
- lib/vindi/rest/discount.rb
|
77
|
+
- lib/vindi/rest/export_batch.rb
|
77
78
|
- lib/vindi/rest/import_batch.rb
|
78
79
|
- lib/vindi/rest/invoice.rb
|
79
80
|
- lib/vindi/rest/issue.rb
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
- !ruby/object:Gem::Version
|
114
115
|
version: '0'
|
115
116
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.1.2
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Ruby toolkit for working with the Vindi API
|