lago-ruby-client 1.16.0 → 1.22.0
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/resources/customer.rb +9 -6
- data/lib/lago/api/resources/invoice.rb +10 -0
- data/lib/lago/api/resources/payment.rb +28 -0
- data/lib/lago/version.rb +1 -1
- data/lib/lago-ruby-client.rb +1 -0
- metadata +49 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926c6e6810dbf0a0a228155d5659e324c20a788d695a30cac3cd04086ae85e6c
|
4
|
+
data.tar.gz: 1aa48f60aad90c36088b5dd56c9e861e7388208591bde9f95b98ff86f0c5e283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda387b14f8aced5db9413ed5dcf91f6b7d496d654dfc297186ec48a07daae78c10b1f98543cf9d4a77f9741ee7bd2d7861cca3d9c3729c52ef7f3308046bdec
|
7
|
+
data.tar.gz: cff9badde84b95b181714a796f4ac33d12e4d70920142f1c7dfa65a60622d89da44630610a4d34255d5d433e1e5059fdc6f222587c3148b7c6791848399278d8
|
@@ -12,11 +12,12 @@ module Lago
|
|
12
12
|
'customer'
|
13
13
|
end
|
14
14
|
|
15
|
-
def current_usage(external_customer_id, external_subscription_id)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def current_usage(external_customer_id, external_subscription_id, apply_taxes: nil)
|
16
|
+
query_params = { external_subscription_id: external_subscription_id }
|
17
|
+
query_params[:apply_taxes] = apply_taxes unless apply_taxes.nil?
|
18
|
+
query_string = URI.encode_www_form(query_params)
|
19
|
+
|
20
|
+
uri = URI("#{client.base_api_url}#{api_resource}/#{external_customer_id}/current_usage?#{query_string}")
|
20
21
|
connection.get(uri, identifier: nil)
|
21
22
|
end
|
22
23
|
|
@@ -46,7 +47,7 @@ module Lago
|
|
46
47
|
"#{client.base_api_url}#{api_resource}/#{external_customer_id}/checkout_url",
|
47
48
|
)
|
48
49
|
|
49
|
-
response = connection.post(uri)[root_name]
|
50
|
+
response = connection.post({}, uri)[root_name]
|
50
51
|
|
51
52
|
JSON.parse(response.to_json, object_class: OpenStruct)
|
52
53
|
end
|
@@ -74,8 +75,10 @@ module Lago
|
|
74
75
|
zipcode: params[:zipcode],
|
75
76
|
currency: params[:currency],
|
76
77
|
tax_codes: params[:tax_codes],
|
78
|
+
invoice_custom_section_codes: params[:invoice_custom_section_codes],
|
77
79
|
timezone: params[:timezone],
|
78
80
|
finalize_zero_amount_invoice: params[:finalize_zero_amount_invoice],
|
81
|
+
skip_invoice_custom_sections: params[:skip_invoice_custom_sections],
|
79
82
|
}
|
80
83
|
|
81
84
|
whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
|
@@ -70,6 +70,16 @@ module Lago
|
|
70
70
|
JSON.parse(response.to_json, object_class: OpenStruct)
|
71
71
|
end
|
72
72
|
|
73
|
+
def preview(params)
|
74
|
+
path = "/api/v1/invoices/preview"
|
75
|
+
payload = params.slice(
|
76
|
+
:customer, :plan_code, :subscription_at, :billing_time, :coupons, :subscriptions
|
77
|
+
)
|
78
|
+
response = connection.post(payload, path)[root_name]
|
79
|
+
|
80
|
+
JSON.parse(response.to_json, object_class: OpenStruct)
|
81
|
+
end
|
82
|
+
|
73
83
|
def whitelist_params(params)
|
74
84
|
result = {
|
75
85
|
payment_status: params[:payment_status],
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lago
|
4
|
+
module Api
|
5
|
+
module Resources
|
6
|
+
class Payment < Base
|
7
|
+
def api_resource
|
8
|
+
'payments'
|
9
|
+
end
|
10
|
+
|
11
|
+
def root_name
|
12
|
+
'payment'
|
13
|
+
end
|
14
|
+
|
15
|
+
def whitelist_params(params)
|
16
|
+
result_hash = {
|
17
|
+
invoice_id: params[:invoice_id],
|
18
|
+
amount_cents: params[:amount_cents],
|
19
|
+
reference: params[:reference],
|
20
|
+
paid_at: params[:paid_at]
|
21
|
+
}.compact
|
22
|
+
|
23
|
+
{ root_name => result_hash }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/lago/version.rb
CHANGED
data/lib/lago-ruby-client.rb
CHANGED
@@ -28,6 +28,7 @@ require 'lago/api/resources/invoiced_usage'
|
|
28
28
|
require 'lago/api/resources/mrr'
|
29
29
|
require 'lago/api/resources/organization'
|
30
30
|
require 'lago/api/resources/overdue_balance'
|
31
|
+
require 'lago/api/resources/payment'
|
31
32
|
require 'lago/api/resources/payment_request'
|
32
33
|
require 'lago/api/resources/plan'
|
33
34
|
require 'lago/api/resources/subscription'
|
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.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovro Colic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: observer
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mutex_m
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bigdecimal
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: factory_bot
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +164,7 @@ dependencies:
|
|
122
164
|
- - ">="
|
123
165
|
- !ruby/object:Gem::Version
|
124
166
|
version: '0'
|
125
|
-
description:
|
167
|
+
description:
|
126
168
|
email:
|
127
169
|
- lovro@getlago.com
|
128
170
|
executables: []
|
@@ -149,6 +191,7 @@ files:
|
|
149
191
|
- lib/lago/api/resources/mrr.rb
|
150
192
|
- lib/lago/api/resources/organization.rb
|
151
193
|
- lib/lago/api/resources/overdue_balance.rb
|
194
|
+
- lib/lago/api/resources/payment.rb
|
152
195
|
- lib/lago/api/resources/payment_request.rb
|
153
196
|
- lib/lago/api/resources/plan.rb
|
154
197
|
- lib/lago/api/resources/subscription.rb
|
@@ -165,7 +208,7 @@ metadata:
|
|
165
208
|
homepage_uri: https://www.getlago.com/
|
166
209
|
source_code_uri: https://github.com/getlago/lago-ruby-client
|
167
210
|
documentation_uri: https://doc.getlago.com
|
168
|
-
post_install_message:
|
211
|
+
post_install_message:
|
169
212
|
rdoc_options: []
|
170
213
|
require_paths:
|
171
214
|
- lib
|
@@ -181,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
224
|
version: '0'
|
182
225
|
requirements: []
|
183
226
|
rubygems_version: 3.3.27
|
184
|
-
signing_key:
|
227
|
+
signing_key:
|
185
228
|
specification_version: 4
|
186
229
|
summary: Lago Rest API client
|
187
230
|
test_files: []
|