lago-ruby-client 0.22.0.pre.beta → 0.26.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/client.rb +4 -0
- data/lib/lago/api/resources/applied_coupon.rb +3 -3
- data/lib/lago/api/resources/customer.rb +16 -0
- data/lib/lago/api/resources/fee.rb +17 -0
- data/lib/lago/api/resources/invoice.rb +19 -4
- data/lib/lago/api/resources/organization.rb +1 -0
- data/lib/lago/version.rb +1 -1
- data/lib/lago-ruby-client.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e204ff11a52c275e6661f589ea9791dac6b9a1cf604cb731691bd2007ecfd0b
|
4
|
+
data.tar.gz: f533db106525e5c8c16dd72c31bb94a1364a51252ecf78d0674211a28fd44082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 455198fd8c2dd377f2fb2e16cc03525cd9816fdd43684f26abb9bac75c9fcc09b3120284d90d0580f15e67f24a546d1f92c4ff48d77b452792fc30f4717eae33
|
7
|
+
data.tar.gz: 5422b9c42f5b25a6615390a11dd0dd7257eabeaf6c8eb82ddb826b952d96d6ddd38421bb7b4020ea35c8f3cd62d1c43fb1787ba7fca4bb09a81bd6d56d00b8e0
|
data/lib/lago/api/client.rb
CHANGED
@@ -12,9 +12,9 @@ module Lago
|
|
12
12
|
'applied_coupon'
|
13
13
|
end
|
14
14
|
|
15
|
-
def destroy(external_customer_id,
|
16
|
-
path = "/api/v1/customers/#{external_customer_id}/
|
17
|
-
response = connection.destroy(path, identifier:
|
15
|
+
def destroy(external_customer_id, applied_coupon_id)
|
16
|
+
path = "/api/v1/customers/#{external_customer_id}/applied_coupons"
|
17
|
+
response = connection.destroy(path, identifier: applied_coupon_id)[root_name]
|
18
18
|
|
19
19
|
JSON.parse(response.to_json, object_class: OpenStruct)
|
20
20
|
end
|
@@ -43,6 +43,9 @@ module Lago
|
|
43
43
|
result_hash[:billing_configuration] = config unless config.empty?
|
44
44
|
end
|
45
45
|
|
46
|
+
metadata = whitelist_metadata(params[:metadata])
|
47
|
+
result_hash[:metadata] = metadata unless metadata.empty?
|
48
|
+
|
46
49
|
{ root_name => result_hash }
|
47
50
|
end
|
48
51
|
|
@@ -54,8 +57,21 @@ module Lago
|
|
54
57
|
:sync,
|
55
58
|
:sync_with_provider,
|
56
59
|
:vat_rate,
|
60
|
+
:document_locale,
|
57
61
|
)
|
58
62
|
end
|
63
|
+
|
64
|
+
def whitelist_metadata(metadata)
|
65
|
+
processed_metadata = []
|
66
|
+
|
67
|
+
metadata.each do |m|
|
68
|
+
result = (m || {}).slice(:id, :key, :value, :display_in_invoice)
|
69
|
+
|
70
|
+
processed_metadata << result unless result.empty?
|
71
|
+
end
|
72
|
+
|
73
|
+
processed_metadata
|
74
|
+
end
|
59
75
|
end
|
60
76
|
end
|
61
77
|
end
|
@@ -41,11 +41,26 @@ module Lago
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def whitelist_params(params)
|
44
|
-
{
|
45
|
-
|
46
|
-
payment_status: params[:payment_status],
|
47
|
-
},
|
44
|
+
result = {
|
45
|
+
payment_status: params[:payment_status],
|
48
46
|
}
|
47
|
+
|
48
|
+
metadata = whitelist_metadata(params[:metadata])
|
49
|
+
result[:metadata] = metadata unless metadata.empty?
|
50
|
+
|
51
|
+
{ root_name => result }
|
52
|
+
end
|
53
|
+
|
54
|
+
def whitelist_metadata(metadata)
|
55
|
+
processed_metadata = []
|
56
|
+
|
57
|
+
metadata.each do |m|
|
58
|
+
result = (m || {}).slice(:id, :key, :value)
|
59
|
+
|
60
|
+
processed_metadata << result unless result.empty?
|
61
|
+
end
|
62
|
+
|
63
|
+
processed_metadata
|
49
64
|
end
|
50
65
|
end
|
51
66
|
end
|
data/lib/lago/version.rb
CHANGED
data/lib/lago-ruby-client.rb
CHANGED
@@ -20,6 +20,7 @@ require 'lago/api/resources/coupon'
|
|
20
20
|
require 'lago/api/resources/credit_note'
|
21
21
|
require 'lago/api/resources/customer'
|
22
22
|
require 'lago/api/resources/event'
|
23
|
+
require 'lago/api/resources/fee'
|
23
24
|
require 'lago/api/resources/group'
|
24
25
|
require 'lago/api/resources/invoice'
|
25
26
|
require 'lago/api/resources/organization'
|
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.26.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-
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/lago/api/resources/credit_note.rb
|
143
143
|
- lib/lago/api/resources/customer.rb
|
144
144
|
- lib/lago/api/resources/event.rb
|
145
|
+
- lib/lago/api/resources/fee.rb
|
145
146
|
- lib/lago/api/resources/group.rb
|
146
147
|
- lib/lago/api/resources/invoice.rb
|
147
148
|
- lib/lago/api/resources/organization.rb
|
@@ -153,7 +154,7 @@ files:
|
|
153
154
|
- lib/lago/version.rb
|
154
155
|
homepage: https://github.com/getlago/lago-ruby-client
|
155
156
|
licenses:
|
156
|
-
-
|
157
|
+
- MIT
|
157
158
|
metadata:
|
158
159
|
homepage_uri: https://www.getlago.com/
|
159
160
|
source_code_uri: https://github.com/getlago/lago-ruby-client
|