lago-ruby-client 0.31.0.pre.beta → 0.32.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lago/api/resources/invoice.rb +31 -0
- data/lib/lago/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d97772a2f0dcee821ce6e0013f2f6e9f65384677c0ee3625a73d6232254f78e
|
4
|
+
data.tar.gz: 2eb6ad88336e733ce70276f6a30d3d72851b7817a815985f1fd777444756b4e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a5a8c868ca8731f6c8ff97cb8ec0eb77cb6b8ebcb3c58322bf7d057e50ca6dbdab65c187ed08f91c75ff9f50671022dc68379bbcc50d345c9421393343dd8b
|
7
|
+
data.tar.gz: e2dd1f11deaa09b86bd1658c094042764a28c2db8ca847af073a45e95778bf27b283f4a56ab2da98d1681dc12058a910cf4cc66e7822d0d252a35005bc74586e
|
@@ -12,6 +12,13 @@ module Lago
|
|
12
12
|
'invoice'
|
13
13
|
end
|
14
14
|
|
15
|
+
def create(params)
|
16
|
+
payload = one_off_params(params)
|
17
|
+
response = connection.post(payload)[root_name]
|
18
|
+
|
19
|
+
JSON.parse(response.to_json, object_class: OpenStruct)
|
20
|
+
end
|
21
|
+
|
15
22
|
def download(invoice_id)
|
16
23
|
path = "/api/v1/invoices/#{invoice_id}/download"
|
17
24
|
response = connection.post({}, path)
|
@@ -62,6 +69,30 @@ module Lago
|
|
62
69
|
|
63
70
|
processed_metadata
|
64
71
|
end
|
72
|
+
|
73
|
+
def one_off_params(params)
|
74
|
+
result = {
|
75
|
+
external_customer_id: params[:external_customer_id],
|
76
|
+
currency: params[:currency],
|
77
|
+
}
|
78
|
+
|
79
|
+
fees = whitelist_fees(params[:fees])
|
80
|
+
result[:fees] = fees unless fees.empty?
|
81
|
+
|
82
|
+
{ root_name => result }
|
83
|
+
end
|
84
|
+
|
85
|
+
def whitelist_fees(fees)
|
86
|
+
processed_fees = []
|
87
|
+
|
88
|
+
fees.each do |f|
|
89
|
+
result = (f || {}).slice(:add_on_code, :unit_amount_cents, :units, :description)
|
90
|
+
|
91
|
+
processed_fees << result unless result.empty?
|
92
|
+
end
|
93
|
+
|
94
|
+
processed_fees
|
95
|
+
end
|
65
96
|
end
|
66
97
|
end
|
67
98
|
end
|
data/lib/lago/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lago-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0.pre.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovro Colic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|