lago-ruby-client 1.27.1 → 1.28.1

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: ce48a3497fef7476000300ddda428ff37f01e0f506799e0c744fad3fcf293313
4
- data.tar.gz: 83cd3144ee1b91cc6c936566cb44eac388d67f837781ca75d8770342a1bcdb6c
3
+ metadata.gz: fd610caee4a2ff899f3e1df71b8ec05e3cdf9baa621f2e31381a0d5099b34166
4
+ data.tar.gz: 32e6c876a229afea712d127754186a13e4ab64cd7c4a7aa0d24e76e310ca0207
5
5
  SHA512:
6
- metadata.gz: ceff68eca118475e42851c2b0944980afff463d78e3bdfecbf0240edbda37a4d3a74bb8cc1ac9ee00f680dec80381b81ea043967ce09b0957ce0f5b7aaceb56a
7
- data.tar.gz: 1dbee2db1f14115e5a16fcc3cfe94dd8a716d893c29afa5a3e966a75cab10424d15b62c24c2922a7aa58d8fe3dbf4f534f0326e325d03cc1c1d93a258dee0ced
6
+ metadata.gz: 8bd0002384610f431a97e8dcfa4164362c55b857c77b42722b74da1c396778379edccfb45594685c2e2bc8eb3467e37bc29634c8a3849c63923834c95b0f4304
7
+ data.tar.gz: b47ba7b6fc1f07e46ad10f03dfef4b74d476fa7aee8032cc8b5e7bc24a97e1ad543d10a5b772fecc157b0caddad83598cc4ea5cc875f113075e4662eddfd4793
@@ -96,6 +96,10 @@ module Lago
96
96
  def webhook_endpoints
97
97
  Lago::Api::Resources::WebhookEndpoint.new(self)
98
98
  end
99
+
100
+ def billing_entities
101
+ Lago::Api::Resources::BillingEntity.new(self)
102
+ end
99
103
  end
100
104
  end
101
105
  end
@@ -11,6 +11,74 @@ module Lago
11
11
  def root_name
12
12
  'billing_entity'
13
13
  end
14
+
15
+ def create(params)
16
+ payload = whitelist_create_params(params)
17
+ response = connection.post(payload)[root_name]
18
+
19
+ JSON.parse(response.to_json, object_class: OpenStruct)
20
+ end
21
+
22
+ def update(params, billing_entity_code)
23
+ payload = whitelist_update_params(params)
24
+ response = connection.put(identifier: billing_entity_code, body: payload)[root_name]
25
+
26
+ JSON.parse(response.to_json, object_class: OpenStruct)
27
+ end
28
+
29
+ def destroy(billing_entity_code)
30
+ raise NotImplementedError
31
+ end
32
+
33
+ def whitelist_create_params(params)
34
+ result_params = params.slice(
35
+ :code,
36
+ :name,
37
+ :address_line1,
38
+ :address_line2,
39
+ :city,
40
+ :state,
41
+ :zipcode,
42
+ :country,
43
+ :email,
44
+ :phone,
45
+ :default_currency,
46
+ :timezone,
47
+ :document_numbering,
48
+ :document_number_prefix,
49
+ :finalize_zero_amount_invoice,
50
+ :net_payment_term,
51
+ :eu_tax_management,
52
+ :logo,
53
+ :legal_name,
54
+ :legal_number,
55
+ :tax_identification_number,
56
+ :email_settings
57
+ ).compact
58
+
59
+ whitelist_billing_configuration(params[:billing_configuration]).tap do |config|
60
+ result_params[:billing_configuration] = config unless config.empty?
61
+ end
62
+
63
+ { root_name => result_params }
64
+ end
65
+
66
+ def whitelist_billing_configuration(billing_params)
67
+ (billing_params || {}).slice(
68
+ :invoice_footer,
69
+ :invoice_grace_period,
70
+ :document_locale,
71
+ )
72
+ end
73
+
74
+ def whitelist_update_params(params)
75
+ result_params = whitelist_create_params(params).dup
76
+
77
+ result_params.delete(:code)
78
+ result_params[:tax_codes] = params[:tax_codes] unless params[:tax_codes].empty?
79
+
80
+ { root_name => result_params }
81
+ end
14
82
  end
15
83
  end
16
84
  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 = '1.27.1'
4
+ VERSION = '1.28.1'
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: 1.27.1
4
+ version: 1.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Colic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-13 00:00:00.000000000 Z
11
+ date: 2025-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt