lago-ruby-client 0.26.0.pre.beta → 0.28.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: 6e204ff11a52c275e6661f589ea9791dac6b9a1cf604cb731691bd2007ecfd0b
4
- data.tar.gz: f533db106525e5c8c16dd72c31bb94a1364a51252ecf78d0674211a28fd44082
3
+ metadata.gz: 879e3651772723343b2ed7934a8e9eaee786a47ceb920325fb53da58b6999c82
4
+ data.tar.gz: 5f64ba4ff7569c9dc3bcb0c143dd1fa98d67ad1b3f3f2e0bd56b6d976ebcbcf8
5
5
  SHA512:
6
- metadata.gz: 455198fd8c2dd377f2fb2e16cc03525cd9816fdd43684f26abb9bac75c9fcc09b3120284d90d0580f15e67f24a546d1f92c4ff48d77b452792fc30f4717eae33
7
- data.tar.gz: 5422b9c42f5b25a6615390a11dd0dd7257eabeaf6c8eb82ddb826b952d96d6ddd38421bb7b4020ea35c8f3cd62d1c43fb1787ba7fca4bb09a81bd6d56d00b8e0
6
+ metadata.gz: 48311654cf0a74fb99fb618c8afcfd2eb250cdd82b28caa6ce271a6e17a6cfe20716ea31a0234b79a7dfced0bc6906a618dd4d0fec2f7dd5270a8c9af0267da3
7
+ data.tar.gz: 44f5f185ddbca8bd5861943e0c5e9ed0531b668b843a6568ff65908729f3c42af20c8ec78bf5889f3f5886d984fcc916b98bb3967dfc7d1db35feae04337546f
@@ -19,6 +19,16 @@ module Lago
19
19
  connection.get(uri, identifier: nil)
20
20
  end
21
21
 
22
+ def portal_url(external_customer_id)
23
+ uri = URI(
24
+ "#{client.base_api_url}#{api_resource}/#{external_customer_id}/portal_url"
25
+ )
26
+
27
+ response = connection.get(uri, identifier: nil)[root_name]
28
+
29
+ JSON.parse(response.to_json, object_class: OpenStruct).portal_url
30
+ end
31
+
22
32
  def whitelist_params(params)
23
33
  result_hash = {
24
34
  external_id: params[:external_id],
@@ -24,6 +24,13 @@ module Lago
24
24
  connection.post(payload, uri)
25
25
  end
26
26
 
27
+ def estimate_fees(params)
28
+ uri = URI("#{client.base_api_url}#{api_resource}/estimate_fees")
29
+
30
+ payload = whitelist_estimate_params(params)
31
+ connection.post(payload, uri)
32
+ end
33
+
27
34
  def whitelist_params(params)
28
35
  {
29
36
  root_name => {
@@ -32,8 +39,8 @@ module Lago
32
39
  code: params[:code],
33
40
  timestamp: params[:timestamp],
34
41
  external_subscription_id: params[:external_subscription_id],
35
- properties: params[:properties]
36
- }.compact
42
+ properties: params[:properties],
43
+ }.compact,
37
44
  }
38
45
  end
39
46
 
@@ -45,8 +52,19 @@ module Lago
45
52
  code: params[:code],
46
53
  timestamp: params[:timestamp],
47
54
  external_subscription_ids: params[:external_subscription_ids],
48
- properties: params[:properties]
49
- }.compact
55
+ properties: params[:properties],
56
+ }.compact,
57
+ }
58
+ end
59
+
60
+ def whitelist_estimate_params(params)
61
+ {
62
+ root_name => {
63
+ code: params[:code],
64
+ external_customer_id: params[:external_customer_id],
65
+ external_subscription_id: params[:external_subscription_id],
66
+ properties: params[:properties],
67
+ }.compact,
50
68
  }
51
69
  end
52
70
  end
@@ -11,6 +11,14 @@ module Lago
11
11
  def root_name
12
12
  'fee'
13
13
  end
14
+
15
+ def whitelist_params(params)
16
+ {
17
+ root_name => {
18
+ payment_status: params[:payment_status],
19
+ },
20
+ }
21
+ end
14
22
  end
15
23
  end
16
24
  end
@@ -25,6 +25,7 @@ module Lago
25
25
  legal_name: params[:legal_name],
26
26
  legal_number: params[:legal_number],
27
27
  timezone: params[:timezone],
28
+ email_settings: params[:email_settings],
28
29
  }.compact
29
30
 
30
31
  whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
@@ -36,7 +36,7 @@ module Lago
36
36
  processed_charges = []
37
37
 
38
38
  charges.each do |c|
39
- result = (c || {}).slice(:id, :billable_metric_id, :charge_model, :properties, :group_properties)
39
+ result = (c || {}).slice(:id, :billable_metric_id, :charge_model, :instant, :properties, :group_properties)
40
40
 
41
41
  processed_charges << result unless result.empty?
42
42
  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.26.0-beta'
4
+ VERSION = '0.28.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.26.0.pre.beta
4
+ version: 0.28.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-03-13 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt