lago-ruby-client 0.39.0.pre.beta → 0.42.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 -4
- data/lib/lago/api/connection.rb +4 -2
- data/lib/lago/api/resources/base.rb +2 -2
- data/lib/lago/api/resources/billable_metric.rb +1 -0
- data/lib/lago/api/resources/customer.rb +1 -0
- data/lib/lago/api/resources/plan.rb +2 -0
- data/lib/lago/api/resources/webhook_endpoint.rb +25 -0
- data/lib/lago/version.rb +1 -1
- data/lib/lago-ruby-client.rb +1 -1
- metadata +3 -3
- data/lib/lago/api/resources/applied_tax.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c74ed77303be8ec35b3c733ba128cb238122a688df86246550a5395a1e59f0d
|
4
|
+
data.tar.gz: 23953066533a3d163692fe938f88358bacdd42fb1a67b0a9149c72d78fdc5ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2e897c9b87db9666e4572dc459758ff4dc844c8a1835468b1a126841726f652eb67e6a4d8fc6229375c4b49b7d059bbc05c4e9e74afc200130bab6b39946af
|
7
|
+
data.tar.gz: 3ec3a01afa6a4cd97945974923f8d4b8bdf6f8bdd878c696c615d7bace7b42d9f98b878895ae6947c40ec6bb06b198053571a7aaaed4864ea1eed715f4edf5d5
|
data/lib/lago/api/client.rb
CHANGED
@@ -51,10 +51,6 @@ module Lago
|
|
51
51
|
Lago::Api::Resources::AppliedAddOn.new(self)
|
52
52
|
end
|
53
53
|
|
54
|
-
def applied_taxes
|
55
|
-
Lago::Api::Resources::AppliedTax.new(self)
|
56
|
-
end
|
57
|
-
|
58
54
|
def billable_metrics
|
59
55
|
Lago::Api::Resources::BillableMetric.new(self)
|
60
56
|
end
|
@@ -94,6 +90,10 @@ module Lago
|
|
94
90
|
def webhooks
|
95
91
|
Lago::Api::Resources::Webhook.new(self)
|
96
92
|
end
|
93
|
+
|
94
|
+
def webhook_endpoints
|
95
|
+
Lago::Api::Resources::WebhookEndpoint.new(self)
|
96
|
+
end
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
data/lib/lago/api/connection.rb
CHANGED
@@ -45,8 +45,10 @@ module Lago
|
|
45
45
|
handle_response(response)
|
46
46
|
end
|
47
47
|
|
48
|
-
def destroy(path = uri.path, identifier:)
|
49
|
-
uri_path =
|
48
|
+
def destroy(path = uri.path, identifier:, options: nil)
|
49
|
+
uri_path = path
|
50
|
+
uri_path += "/#{identifier}" if identifier
|
51
|
+
uri_path += "?#{URI.encode_www_form(options)}" unless options.nil?
|
50
52
|
response = http_client.send_request(
|
51
53
|
'DELETE',
|
52
54
|
uri_path,
|
@@ -42,8 +42,8 @@ module Lago
|
|
42
42
|
JSON.parse(response.to_json, object_class: OpenStruct)
|
43
43
|
end
|
44
44
|
|
45
|
-
def destroy(identifier)
|
46
|
-
response = connection.destroy(identifier: identifier)[root_name]
|
45
|
+
def destroy(identifier, options: nil)
|
46
|
+
response = connection.destroy(identifier: identifier, options: options)[root_name]
|
47
47
|
|
48
48
|
JSON.parse(response.to_json, object_class: OpenStruct)
|
49
49
|
end
|
@@ -23,6 +23,7 @@ module Lago
|
|
23
23
|
trial_period: params[:trial_period],
|
24
24
|
pay_in_advance: params[:pay_in_advance],
|
25
25
|
bill_charges_monthly: params[:bill_charges_monthly],
|
26
|
+
tax_codes: params[:tax_codes],
|
26
27
|
}.compact
|
27
28
|
|
28
29
|
whitelist_charges(params[:charges]).tap do |charges|
|
@@ -45,6 +46,7 @@ module Lago
|
|
45
46
|
:min_amount_cents,
|
46
47
|
:properties,
|
47
48
|
:group_properties,
|
49
|
+
:tax_codes,
|
48
50
|
)
|
49
51
|
|
50
52
|
processed_charges << result unless result.empty?
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lago
|
4
|
+
module Api
|
5
|
+
module Resources
|
6
|
+
class WebhookEndpoint < Base
|
7
|
+
def api_resource
|
8
|
+
'webhook_endpoints'
|
9
|
+
end
|
10
|
+
|
11
|
+
def root_name
|
12
|
+
'webhook_endpoint'
|
13
|
+
end
|
14
|
+
|
15
|
+
def whitelist_params(params)
|
16
|
+
{
|
17
|
+
root_name => {
|
18
|
+
webhook_url: params[:webhook_url],
|
19
|
+
}.compact,
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/lago/version.rb
CHANGED
data/lib/lago-ruby-client.rb
CHANGED
@@ -15,7 +15,6 @@ require 'lago/api/resources/base'
|
|
15
15
|
require 'lago/api/resources/add_on'
|
16
16
|
require 'lago/api/resources/applied_add_on'
|
17
17
|
require 'lago/api/resources/applied_coupon'
|
18
|
-
require 'lago/api/resources/applied_tax'
|
19
18
|
require 'lago/api/resources/billable_metric'
|
20
19
|
require 'lago/api/resources/coupon'
|
21
20
|
require 'lago/api/resources/credit_note'
|
@@ -31,3 +30,4 @@ require 'lago/api/resources/tax'
|
|
31
30
|
require 'lago/api/resources/wallet'
|
32
31
|
require 'lago/api/resources/wallet_transaction'
|
33
32
|
require 'lago/api/resources/webhook'
|
33
|
+
require 'lago/api/resources/webhook_endpoint'
|
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.42.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-07
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -136,7 +136,6 @@ files:
|
|
136
136
|
- lib/lago/api/resources/add_on.rb
|
137
137
|
- lib/lago/api/resources/applied_add_on.rb
|
138
138
|
- lib/lago/api/resources/applied_coupon.rb
|
139
|
-
- lib/lago/api/resources/applied_tax.rb
|
140
139
|
- lib/lago/api/resources/base.rb
|
141
140
|
- lib/lago/api/resources/billable_metric.rb
|
142
141
|
- lib/lago/api/resources/coupon.rb
|
@@ -153,6 +152,7 @@ files:
|
|
153
152
|
- lib/lago/api/resources/wallet.rb
|
154
153
|
- lib/lago/api/resources/wallet_transaction.rb
|
155
154
|
- lib/lago/api/resources/webhook.rb
|
155
|
+
- lib/lago/api/resources/webhook_endpoint.rb
|
156
156
|
- lib/lago/version.rb
|
157
157
|
homepage: https://github.com/getlago/lago-ruby-client
|
158
158
|
licenses:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lago
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class AppliedTax < Base
|
7
|
-
def api_resource
|
8
|
-
'applied_tax'
|
9
|
-
end
|
10
|
-
|
11
|
-
def root_name
|
12
|
-
'applied_tax'
|
13
|
-
end
|
14
|
-
|
15
|
-
def create(external_customer_id, params)
|
16
|
-
path = "/api/v1/customers/#{external_customer_id}/applied_taxes"
|
17
|
-
payload = whitelist_params(params)
|
18
|
-
response = connection.post(payload, path)[root_name]
|
19
|
-
|
20
|
-
JSON.parse(response.to_json, object_class: OpenStruct)
|
21
|
-
end
|
22
|
-
|
23
|
-
def destroy(external_customer_id, tax_code)
|
24
|
-
path = "/api/v1/customers/#{external_customer_id}/applied_taxes"
|
25
|
-
response = connection.destroy(path, identifier: tax_code)[root_name]
|
26
|
-
|
27
|
-
JSON.parse(response.to_json, object_class: OpenStruct)
|
28
|
-
end
|
29
|
-
|
30
|
-
def whitelist_params(params)
|
31
|
-
{
|
32
|
-
root_name => {
|
33
|
-
tax_code: params[:tax_code],
|
34
|
-
}.compact,
|
35
|
-
}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|