lago-ruby-client 0.49.0.pre.beta → 0.51.0.pre.beta

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 072a79f8acff2afd5899ae8ff2780ec1eba4fc769b3799ee8b465ee5c1941265
4
- data.tar.gz: 296248f68d455e649dd05b79e6d4092b44d7c1aacf2f37870617348f5a366542
3
+ metadata.gz: 498d6b5147ab708bbc13406f1b316af58ff461db03dc97065bc010643539afca
4
+ data.tar.gz: 2f346aa3288af414d787958bcbe941784065fd367f1c44ed301e2ec15aa68533
5
5
  SHA512:
6
- metadata.gz: 60a9a6bd1bc167e54db965d0feccba55a8f4f57e4ce19da8f55708ba7dd27a3257144329e90f340376e0456998117a6a8ce82811b719e6878bb7c645a1873cd6
7
- data.tar.gz: 9490fc69ee57f8293f2cf7ca7608bed779b2bbc1444e6a0d3dcafba7d35618eab26868f140608a9c65bac6ffa207f589a474e8d6423059b6140582595957086b
6
+ metadata.gz: 74ae5d6737ce4b643aadedd30ff4ab3ba0e3de3fa422ed24d36e71f92e9a76bde03b87a3a642ffcebfd400c336480fbc55f6ba1fd97826a5631e167d0c96c8b9
7
+ data.tar.gz: '0348874bd1b95be6fa3ca1aa0b6b0ce10e8d3580a65d481d3d84fa7178d161062e4257858f583509380c4f204a0591585f57ac8dd7fb0b59dcc7ff051e9eebad'
@@ -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
@@ -12,11 +12,6 @@ module Lago
12
12
  'event'
13
13
  end
14
14
 
15
- def create(params)
16
- payload = whitelist_params(params)
17
- connection.post(payload)
18
- end
19
-
20
15
  def batch_create(params)
21
16
  uri = URI("#{client.base_api_url}#{api_resource}/batch")
22
17
 
@@ -23,6 +23,7 @@ module Lago
23
23
  subscription_at: params[:subscription_at],
24
24
  ending_at: params[:ending_at],
25
25
  subscription_date: params[:subscription_date], # Deprecated
26
+ plan_overrides: params[:plan_overrides],
26
27
  }.compact
27
28
  }
28
29
  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.49.0-beta'
4
+ VERSION = '0.51.0-beta'
5
5
  end
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.49.0.pre.beta
4
+ version: 0.51.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-10-05 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt