lago-ruby-client 1.5.0 → 1.7.0
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 +0 -4
- data/lib/lago/api/resources/billable_metric.rb +0 -1
- data/lib/lago/api/resources/customer.rb +31 -0
- data/lib/lago/api/resources/event.rb +0 -2
- data/lib/lago/api/resources/overdue_balance.rb +17 -0
- data/lib/lago/api/resources/plan.rb +0 -1
- data/lib/lago/api/resources/subscription.rb +1 -2
- data/lib/lago/version.rb +1 -1
- data/lib/lago-ruby-client.rb +1 -1
- metadata +3 -3
- data/lib/lago/api/resources/group.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c34063ea8038343ad6d3ee6c4de235dbfb920a43f041da7cd3d578b616aae43
|
4
|
+
data.tar.gz: 012faa373eb04d2861c77a329bd63f1ae9bb8822abcd6a3e34aa15f677c0c387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18c90aa530a176e78c0af1195faff254a96b9de3b54ec4d4094cda5ce53ff85ccc6691e72b69f623a6f5f5589c68a9b3264954e539109a790bbb7ed8f3c036f0
|
7
|
+
data.tar.gz: 29bbd820a54125edf9d03f3bc813a9abb852968dce42276674be0bc6292246345a3cb30eac2f9d3c8b327027be3ed3b9016fde8845bc04b93ee9e85c1a9886ca
|
data/lib/lago/api/client.rb
CHANGED
@@ -78,6 +78,13 @@ module Lago
|
|
78
78
|
result_hash[:billing_configuration] = config unless config.empty?
|
79
79
|
end
|
80
80
|
|
81
|
+
whitelist_shipping_address(params[:shipping_address]).tap do |address|
|
82
|
+
result_hash[:shipping_address] = address unless address.empty?
|
83
|
+
end
|
84
|
+
|
85
|
+
integration_customers = whitelist_integration_customers(params[:integration_customers])
|
86
|
+
result_hash[:integration_customers] = integration_customers unless integration_customers.empty?
|
87
|
+
|
81
88
|
metadata = whitelist_metadata(params[:metadata])
|
82
89
|
result_hash[:metadata] = metadata unless metadata.empty?
|
83
90
|
|
@@ -97,6 +104,30 @@ module Lago
|
|
97
104
|
)
|
98
105
|
end
|
99
106
|
|
107
|
+
def whitelist_shipping_address(address)
|
108
|
+
(address || {}).slice(
|
109
|
+
:address_line1,
|
110
|
+
:address_line2,
|
111
|
+
:city,
|
112
|
+
:zipcode,
|
113
|
+
:state,
|
114
|
+
:country,
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
def whitelist_integration_customers(integration_customers)
|
119
|
+
processed_integration_customers = []
|
120
|
+
|
121
|
+
(integration_customers || []).each do |m|
|
122
|
+
result = (m || {})
|
123
|
+
.slice(:id, :external_customer_id, :integration_type, :integration_code, :subsidiary_id, :sync_with_provider)
|
124
|
+
|
125
|
+
processed_integration_customers << result unless result.empty?
|
126
|
+
end
|
127
|
+
|
128
|
+
processed_integration_customers
|
129
|
+
end
|
130
|
+
|
100
131
|
def whitelist_metadata(metadata)
|
101
132
|
processed_metadata = []
|
102
133
|
|
@@ -30,7 +30,6 @@ module Lago
|
|
30
30
|
{
|
31
31
|
root_name => {
|
32
32
|
transaction_id: params[:transaction_id],
|
33
|
-
external_customer_id: params[:external_customer_id],
|
34
33
|
code: params[:code],
|
35
34
|
timestamp: params[:timestamp],
|
36
35
|
external_subscription_id: params[:external_subscription_id],
|
@@ -49,7 +48,6 @@ module Lago
|
|
49
48
|
{
|
50
49
|
root_name => {
|
51
50
|
code: params[:code],
|
52
|
-
external_customer_id: params[:external_customer_id],
|
53
51
|
external_subscription_id: params[:external_subscription_id],
|
54
52
|
properties: params[:properties],
|
55
53
|
}.compact,
|
@@ -22,9 +22,8 @@ module Lago
|
|
22
22
|
billing_time: params[:billing_time],
|
23
23
|
subscription_at: params[:subscription_at],
|
24
24
|
ending_at: params[:ending_at],
|
25
|
-
subscription_date: params[:subscription_date], # Deprecated
|
26
25
|
plan_overrides: params[:plan_overrides],
|
27
|
-
}.compact
|
26
|
+
}.compact,
|
28
27
|
}
|
29
28
|
end
|
30
29
|
end
|
data/lib/lago/version.rb
CHANGED
data/lib/lago-ruby-client.rb
CHANGED
@@ -21,12 +21,12 @@ require 'lago/api/resources/customer'
|
|
21
21
|
require 'lago/api/resources/event'
|
22
22
|
require 'lago/api/resources/fee'
|
23
23
|
require 'lago/api/resources/gross_revenue'
|
24
|
-
require 'lago/api/resources/group'
|
25
24
|
require 'lago/api/resources/invoice'
|
26
25
|
require 'lago/api/resources/invoice_collection'
|
27
26
|
require 'lago/api/resources/invoiced_usage'
|
28
27
|
require 'lago/api/resources/mrr'
|
29
28
|
require 'lago/api/resources/organization'
|
29
|
+
require 'lago/api/resources/overdue_balance'
|
30
30
|
require 'lago/api/resources/plan'
|
31
31
|
require 'lago/api/resources/subscription'
|
32
32
|
require 'lago/api/resources/tax'
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovro Colic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -143,12 +143,12 @@ files:
|
|
143
143
|
- lib/lago/api/resources/event.rb
|
144
144
|
- lib/lago/api/resources/fee.rb
|
145
145
|
- lib/lago/api/resources/gross_revenue.rb
|
146
|
-
- lib/lago/api/resources/group.rb
|
147
146
|
- lib/lago/api/resources/invoice.rb
|
148
147
|
- lib/lago/api/resources/invoice_collection.rb
|
149
148
|
- lib/lago/api/resources/invoiced_usage.rb
|
150
149
|
- lib/lago/api/resources/mrr.rb
|
151
150
|
- lib/lago/api/resources/organization.rb
|
151
|
+
- lib/lago/api/resources/overdue_balance.rb
|
152
152
|
- lib/lago/api/resources/plan.rb
|
153
153
|
- lib/lago/api/resources/subscription.rb
|
154
154
|
- lib/lago/api/resources/tax.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lago
|
4
|
-
module Api
|
5
|
-
module Resources
|
6
|
-
class Group < Base
|
7
|
-
def api_resource
|
8
|
-
'groups'
|
9
|
-
end
|
10
|
-
|
11
|
-
def root_name
|
12
|
-
'group'
|
13
|
-
end
|
14
|
-
|
15
|
-
def get_all(code, options = {})
|
16
|
-
path = "/api/v1/billable_metrics/#{code}/groups"
|
17
|
-
response = connection.get_all(options, path)
|
18
|
-
|
19
|
-
JSON.parse(response.to_json, object_class: OpenStruct)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|