lago-ruby-client 0.50.0.pre.beta → 0.52.1.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: 6648835d8488417de038880a3124b10d68756f9185098fa54250e9167566a8e9
4
- data.tar.gz: a26d2b61479f46e1ba144c048aa7127f73889950d26bf0a761dc34e290df6663
3
+ metadata.gz: 137db577a0be3e40014c0530d482d92531a8ce5ec6169eed1bc8500834a6d712
4
+ data.tar.gz: ac6157ccaa1c32e86a1457300362bd09b2f00953c2944ecbe258352d6634f061
5
5
  SHA512:
6
- metadata.gz: 3b52dc25f131fb69f85ef12c6f7236cd48c7d839a883bc5b1407770b16a095c714f5f0c98f588c99cac026b5bb4899e78124678f297ffd42ab27495d8b4354e1
7
- data.tar.gz: a0e8af78ed0d728f77507391c78de2cb56a73e205c6560b850d21e46da9e1ef47b7933e299154a9f4656139bd622e2521c7f103c86cc395f5b97adca76a74d94
6
+ metadata.gz: deb5690fad91ec7110ddb5e2023c6de25dab18246f1a34e02e5086b5bb44c4f08614bfe8d3ce52ed4c8219e2dd6613e47edfdca08f9b10148e630c96231549d5
7
+ data.tar.gz: 720409f69a56ae3f1a2b0c170f69ebd79799c5c71d947c380fcbd4ddc1f0f407611ca5f1f65564b497c39028d5f740091df2748572ab5c7fbfe368f7cda8f92b
@@ -57,6 +57,25 @@ module Lago
57
57
 
58
58
  JSON.parse(response.to_json, object_class: OpenStruct).credit_note
59
59
  end
60
+
61
+ def estimate(params)
62
+ uri = URI("#{client.base_api_url}#{api_resource}/estimate")
63
+
64
+ payload = whitelist_estimate_params(params)
65
+ response = connection.post(payload, uri)['estimated_credit_note']
66
+
67
+ JSON.parse(response.to_json, object_class: OpenStruct)
68
+ end
69
+
70
+ def whitelist_estimate_params(params)
71
+ result_hash = { invoice_id: params[:invoice_id] }.compact
72
+
73
+ whitelist_items(params[:items] || []).tap do |items|
74
+ result_hash[:items] = items unless items.empty?
75
+ end
76
+
77
+ { root_name => result_hash }
78
+ end
60
79
  end
61
80
  end
62
81
  end
@@ -41,6 +41,16 @@ module Lago
41
41
  JSON.parse(response.to_json, object_class: OpenStruct).portal_url
42
42
  end
43
43
 
44
+ def checkout_url(external_customer_id)
45
+ uri = URI(
46
+ "#{client.base_api_url}#{api_resource}/#{external_customer_id}/checkout_url",
47
+ )
48
+
49
+ response = connection.post(uri, identifier: nil)[root_name]
50
+
51
+ JSON.parse(response.to_json, object_class: OpenStruct).checkout_url
52
+ end
53
+
44
54
  def whitelist_params(params)
45
55
  result_hash = {
46
56
  external_id: params[:external_id],
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lago
4
+ module Api
5
+ module Resources
6
+ class GrossRevenue < Base
7
+ def api_resource
8
+ 'analytics/gross_revenue'
9
+ end
10
+
11
+ def root_name
12
+ 'gross_revenue'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lago
4
+ module Api
5
+ module Resources
6
+ class InvoicedUsage < Base
7
+ def api_resource
8
+ 'analytics/invoiced_usage'
9
+ end
10
+
11
+ def root_name
12
+ 'invoiced_usage'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lago
4
+ module Api
5
+ module Resources
6
+ class Mrr < Base
7
+ def api_resource
8
+ 'analytics/mrr'
9
+ end
10
+
11
+ def root_name
12
+ 'mrr'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -17,6 +17,7 @@ module Lago
17
17
  webhook_url: params[:webhook_url],
18
18
  webhook_urls: params[:webhook_urls],
19
19
  country: params[:country],
20
+ default_currency: params[:default_currency],
20
21
  address_line1: params[:address_line1],
21
22
  address_line2: params[:address_line2],
22
23
  state: params[:state],
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lago
4
+ module Api
5
+ module Resources
6
+ class OutstandingInvoice < Base
7
+ def api_resource
8
+ 'analytics/outstanding_invoices'
9
+ end
10
+
11
+ def root_name
12
+ 'outstanding_invoice'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ 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.50.0-beta'
4
+ VERSION = '0.52.1-beta'
5
5
  end
@@ -20,9 +20,13 @@ require 'lago/api/resources/credit_note'
20
20
  require 'lago/api/resources/customer'
21
21
  require 'lago/api/resources/event'
22
22
  require 'lago/api/resources/fee'
23
+ require 'lago/api/resources/gross_revenue'
23
24
  require 'lago/api/resources/group'
24
25
  require 'lago/api/resources/invoice'
26
+ require 'lago/api/resources/invoiced_usage'
27
+ require 'lago/api/resources/mrr'
25
28
  require 'lago/api/resources/organization'
29
+ require 'lago/api/resources/outstanding_invoice'
26
30
  require 'lago/api/resources/plan'
27
31
  require 'lago/api/resources/subscription'
28
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.50.0.pre.beta
4
+ version: 0.52.1.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-10-17 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -142,9 +142,13 @@ files:
142
142
  - lib/lago/api/resources/customer.rb
143
143
  - lib/lago/api/resources/event.rb
144
144
  - lib/lago/api/resources/fee.rb
145
+ - lib/lago/api/resources/gross_revenue.rb
145
146
  - lib/lago/api/resources/group.rb
146
147
  - lib/lago/api/resources/invoice.rb
148
+ - lib/lago/api/resources/invoiced_usage.rb
149
+ - lib/lago/api/resources/mrr.rb
147
150
  - lib/lago/api/resources/organization.rb
151
+ - lib/lago/api/resources/outstanding_invoice.rb
148
152
  - lib/lago/api/resources/plan.rb
149
153
  - lib/lago/api/resources/subscription.rb
150
154
  - lib/lago/api/resources/tax.rb
@@ -175,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
179
  - !ruby/object:Gem::Version
176
180
  version: 1.3.1
177
181
  requirements: []
178
- rubygems_version: 3.0.3.1
182
+ rubygems_version: 3.3.3
179
183
  signing_key:
180
184
  specification_version: 4
181
185
  summary: Lago Rest API client