lago-ruby-client 1.27.1 → 1.28.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.
- checksums.yaml +4 -4
- data/lib/lago/api/client.rb +4 -0
- data/lib/lago/api/resources/billing_entity.rb +68 -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: fd610caee4a2ff899f3e1df71b8ec05e3cdf9baa621f2e31381a0d5099b34166
|
4
|
+
data.tar.gz: 32e6c876a229afea712d127754186a13e4ab64cd7c4a7aa0d24e76e310ca0207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bd0002384610f431a97e8dcfa4164362c55b857c77b42722b74da1c396778379edccfb45594685c2e2bc8eb3467e37bc29634c8a3849c63923834c95b0f4304
|
7
|
+
data.tar.gz: b47ba7b6fc1f07e46ad10f03dfef4b74d476fa7aee8032cc8b5e7bc24a97e1ad543d10a5b772fecc157b0caddad83598cc4ea5cc875f113075e4662eddfd4793
|
data/lib/lago/api/client.rb
CHANGED
@@ -11,6 +11,74 @@ module Lago
|
|
11
11
|
def root_name
|
12
12
|
'billing_entity'
|
13
13
|
end
|
14
|
+
|
15
|
+
def create(params)
|
16
|
+
payload = whitelist_create_params(params)
|
17
|
+
response = connection.post(payload)[root_name]
|
18
|
+
|
19
|
+
JSON.parse(response.to_json, object_class: OpenStruct)
|
20
|
+
end
|
21
|
+
|
22
|
+
def update(params, billing_entity_code)
|
23
|
+
payload = whitelist_update_params(params)
|
24
|
+
response = connection.put(identifier: billing_entity_code, body: payload)[root_name]
|
25
|
+
|
26
|
+
JSON.parse(response.to_json, object_class: OpenStruct)
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy(billing_entity_code)
|
30
|
+
raise NotImplementedError
|
31
|
+
end
|
32
|
+
|
33
|
+
def whitelist_create_params(params)
|
34
|
+
result_params = params.slice(
|
35
|
+
:code,
|
36
|
+
:name,
|
37
|
+
:address_line1,
|
38
|
+
:address_line2,
|
39
|
+
:city,
|
40
|
+
:state,
|
41
|
+
:zipcode,
|
42
|
+
:country,
|
43
|
+
:email,
|
44
|
+
:phone,
|
45
|
+
:default_currency,
|
46
|
+
:timezone,
|
47
|
+
:document_numbering,
|
48
|
+
:document_number_prefix,
|
49
|
+
:finalize_zero_amount_invoice,
|
50
|
+
:net_payment_term,
|
51
|
+
:eu_tax_management,
|
52
|
+
:logo,
|
53
|
+
:legal_name,
|
54
|
+
:legal_number,
|
55
|
+
:tax_identification_number,
|
56
|
+
:email_settings
|
57
|
+
).compact
|
58
|
+
|
59
|
+
whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
|
60
|
+
result_params[:billing_configuration] = config unless config.empty?
|
61
|
+
end
|
62
|
+
|
63
|
+
{ root_name => result_params }
|
64
|
+
end
|
65
|
+
|
66
|
+
def whitelist_billing_configuration(billing_params)
|
67
|
+
(billing_params || {}).slice(
|
68
|
+
:invoice_footer,
|
69
|
+
:invoice_grace_period,
|
70
|
+
:document_locale,
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def whitelist_update_params(params)
|
75
|
+
result_params = whitelist_create_params(params).dup
|
76
|
+
|
77
|
+
result_params.delete(:code)
|
78
|
+
result_params[:tax_codes] = params[:tax_codes] unless params[:tax_codes].empty?
|
79
|
+
|
80
|
+
{ root_name => result_params }
|
81
|
+
end
|
14
82
|
end
|
15
83
|
end
|
16
84
|
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: 1.
|
4
|
+
version: 1.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovro Colic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|