lago-ruby-client 0.52.1.pre.beta → 0.53.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 137db577a0be3e40014c0530d482d92531a8ce5ec6169eed1bc8500834a6d712
4
- data.tar.gz: ac6157ccaa1c32e86a1457300362bd09b2f00953c2944ecbe258352d6634f061
3
+ metadata.gz: 43b2c0391e420fdd64ab2e1094e32ecfc20c7357b59c90fcfe59a8175ff36f08
4
+ data.tar.gz: '0195bb3759d72872ae09e8977abd4d1b7031450ce56ce85ea3db1bd788797a22'
5
5
  SHA512:
6
- metadata.gz: deb5690fad91ec7110ddb5e2023c6de25dab18246f1a34e02e5086b5bb44c4f08614bfe8d3ce52ed4c8219e2dd6613e47edfdca08f9b10148e630c96231549d5
7
- data.tar.gz: 720409f69a56ae3f1a2b0c170f69ebd79799c5c71d947c380fcbd4ddc1f0f407611ca5f1f65564b497c39028d5f740091df2748572ab5c7fbfe368f7cda8f92b
6
+ metadata.gz: 446ee955c112c79ab501a3200cf242d9155e4608b87ed5371798ad62ebe0f078f88cf092c384dd989ec29766cb538cea920e798464df190724c44ed6347a4c2f
7
+ data.tar.gz: 9d7ae935d4603a3229b62594a313b8803e5ab06ba19c90699ffb44165de440b0ee57820b6bbbdcdb50c643c1f0a48f9b5753f987cc8cc72520a5cf89b683f2d3
@@ -22,7 +22,7 @@ module Lago
22
22
  end
23
23
 
24
24
  def put(path = uri.path, identifier:, body:)
25
- uri_path = identifier.nil? ? path : "#{path}/#{identifier}"
25
+ uri_path = identifier.nil? ? path : "#{path}/#{URI.encode_www_form_component(identifier)}"
26
26
  response = http_client.send_request(
27
27
  'PUT',
28
28
  uri_path,
@@ -34,7 +34,7 @@ module Lago
34
34
  end
35
35
 
36
36
  def get(path = uri.path, identifier:)
37
- uri_path = identifier.nil? ? path : "#{path}/#{identifier}"
37
+ uri_path = identifier.nil? ? path : "#{path}/#{URI.encode_www_form_component(identifier)}"
38
38
  response = http_client.send_request(
39
39
  'GET',
40
40
  uri_path,
@@ -47,7 +47,7 @@ module Lago
47
47
 
48
48
  def destroy(path = uri.path, identifier:, options: nil)
49
49
  uri_path = path
50
- uri_path += "/#{identifier}" if identifier
50
+ uri_path += "/#{URI.encode_www_form_component(identifier)}" if identifier
51
51
  uri_path += "?#{URI.encode_www_form(options)}" unless options.nil?
52
52
  response = http_client.send_request(
53
53
  'DELETE',
@@ -3,13 +3,13 @@
3
3
  module Lago
4
4
  module Api
5
5
  module Resources
6
- class OutstandingInvoice < Base
6
+ class InvoiceCollection < Base
7
7
  def api_resource
8
- 'analytics/outstanding_invoices'
8
+ 'analytics/invoice_collection'
9
9
  end
10
10
 
11
11
  def root_name
12
- 'outstanding_invoice'
12
+ 'invoice_collection'
13
13
  end
14
14
  end
15
15
  end
@@ -30,6 +30,8 @@ module Lago
30
30
  tax_identification_number: params[:tax_identification_number],
31
31
  timezone: params[:timezone],
32
32
  email_settings: params[:email_settings],
33
+ document_numbering: params[:document_numbering],
34
+ document_number_prefix: params[:document_number_prefix],
33
35
  }.compact
34
36
 
35
37
  whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
@@ -13,17 +13,39 @@ module Lago
13
13
  end
14
14
 
15
15
  def whitelist_params(params)
16
- {
17
- root_name => {
18
- external_customer_id: params[:external_customer_id],
19
- rate_amount: params[:rate_amount],
20
- name: params[:name],
21
- paid_credits: params[:paid_credits],
22
- granted_credits: params[:granted_credits],
23
- currency: params[:currency],
24
- expiration_at: params[:expiration_at],
25
- }.compact,
26
- }
16
+ result_hash = {
17
+ external_customer_id: params[:external_customer_id],
18
+ rate_amount: params[:rate_amount],
19
+ name: params[:name],
20
+ paid_credits: params[:paid_credits],
21
+ granted_credits: params[:granted_credits],
22
+ currency: params[:currency],
23
+ expiration_at: params[:expiration_at],
24
+ }.compact
25
+
26
+ recurring_rules = whitelist_recurring_rules(params[:recurring_transaction_rules])
27
+ result_hash[:recurring_transaction_rules] = recurring_rules unless recurring_rules.empty?
28
+
29
+ { root_name => result_hash }
30
+ end
31
+
32
+ def whitelist_recurring_rules(rules)
33
+ processed_rules = []
34
+
35
+ (rules || []).each do |r|
36
+ result = (r || {}).slice(
37
+ :lago_id,
38
+ :paid_credits,
39
+ :granted_credits,
40
+ :rule_type,
41
+ :threshold_credits,
42
+ :interval,
43
+ )
44
+
45
+ processed_rules << result unless result.empty?
46
+ end
47
+
48
+ processed_rules
27
49
  end
28
50
  end
29
51
  end
data/lib/lago/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lago
4
- VERSION = '0.52.1-beta'
4
+ VERSION = '0.53.0-beta'
5
5
  end
@@ -23,10 +23,10 @@ require 'lago/api/resources/fee'
23
23
  require 'lago/api/resources/gross_revenue'
24
24
  require 'lago/api/resources/group'
25
25
  require 'lago/api/resources/invoice'
26
+ require 'lago/api/resources/invoice_collection'
26
27
  require 'lago/api/resources/invoiced_usage'
27
28
  require 'lago/api/resources/mrr'
28
29
  require 'lago/api/resources/organization'
29
- require 'lago/api/resources/outstanding_invoice'
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: 0.52.1.pre.beta
4
+ version: 0.53.0.pre.beta
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: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - lovro@getlago.com
128
128
  executables: []
@@ -145,10 +145,10 @@ files:
145
145
  - lib/lago/api/resources/gross_revenue.rb
146
146
  - lib/lago/api/resources/group.rb
147
147
  - lib/lago/api/resources/invoice.rb
148
+ - lib/lago/api/resources/invoice_collection.rb
148
149
  - lib/lago/api/resources/invoiced_usage.rb
149
150
  - lib/lago/api/resources/mrr.rb
150
151
  - lib/lago/api/resources/organization.rb
151
- - lib/lago/api/resources/outstanding_invoice.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
@@ -164,7 +164,7 @@ metadata:
164
164
  homepage_uri: https://www.getlago.com/
165
165
  source_code_uri: https://github.com/getlago/lago-ruby-client
166
166
  documentation_uri: https://doc.getlago.com
167
- post_install_message:
167
+ post_install_message:
168
168
  rdoc_options: []
169
169
  require_paths:
170
170
  - lib
@@ -179,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  - !ruby/object:Gem::Version
180
180
  version: 1.3.1
181
181
  requirements: []
182
- rubygems_version: 3.3.3
183
- signing_key:
182
+ rubygems_version: 3.0.9
183
+ signing_key:
184
184
  specification_version: 4
185
185
  summary: Lago Rest API client
186
186
  test_files: []