lago-ruby-client 1.35.0 → 1.37.0

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: aa5e9bcd28c915dd10e0d3aa5676c82ef6ac36b6e32413db8fff40983d298621
4
- data.tar.gz: 60e48e0f100c01afa0ebff4c0b01216876ce013f8da3bc11c70079c1e1c134ed
3
+ metadata.gz: 600a30a440f5566e5d00ac7cf7ed11cd892549687f84f7101b3efa123344ed09
4
+ data.tar.gz: acf19141562235fbb7fb9b2ebd122c31daa8affcb835ea44a48a28af604f40ed
5
5
  SHA512:
6
- metadata.gz: 870668ed7485af2119524c9621a3b8cd0b2e4f82ed6d95ba8e14473f9098195d93ed5230e27a9a2f41618ce5d2e0ee50ea111bb9199373a03705658957a3f9c5
7
- data.tar.gz: 02e656a9e580d3fef35c860b39c60d907157c6959ef58db4297d15031896435642cc0e43fb67c619030c147a83a6cf0eae4d864af98076a67589e20404d60806
6
+ metadata.gz: 41a39e59ded39792a643aa24ee1daa2d844c2f5d054aa984a880df8f9014d976d0c0f0cb47d82e48ebb9b4dfea305b827e17532ac22516556982a7239626361a
7
+ data.tar.gz: 7528982c6f111e71c028957cfe039b9802cb86accb28639b0691233184385888534865a5da02b4f0b7cf3d8ef7d2a35b6ac06572098700bb445ddfb1c0fe01d1
@@ -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}/#{URI.encode_www_form_component(identifier)}"
25
+ uri_path = identifier.nil? ? path : "#{path}/#{CGI.escapeURIComponent(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 patch(path = uri.path, identifier:, body:)
37
- uri_path = identifier.nil? ? path : "#{path}/#{URI.encode_www_form_component(identifier)}"
37
+ uri_path = identifier.nil? ? path : "#{path}/#{CGI.escapeURIComponent(identifier)}"
38
38
  response = http_client.send_request(
39
39
  'PATCH',
40
40
  uri_path,
@@ -46,7 +46,7 @@ module Lago
46
46
  end
47
47
 
48
48
  def get(path = uri.path, identifier:)
49
- uri_path = identifier.nil? ? path : "#{path}/#{URI.encode_www_form_component(identifier)}"
49
+ uri_path = identifier.nil? ? path : "#{path}/#{CGI.escapeURIComponent(identifier)}"
50
50
  response = http_client.send_request(
51
51
  'GET',
52
52
  uri_path,
@@ -59,7 +59,7 @@ module Lago
59
59
 
60
60
  def destroy(path = uri.path, identifier:, options: nil)
61
61
  uri_path = path
62
- uri_path += "/#{URI.encode_www_form_component(identifier)}" if identifier
62
+ uri_path += "/#{CGI.escapeURIComponent(identifier)}" if identifier
63
63
  uri_path += "?#{URI.encode_www_form(options)}" unless options.nil?
64
64
  response = http_client.send_request(
65
65
  'DELETE',
@@ -69,12 +69,14 @@ module Lago
69
69
  (billing_params || {}).slice(
70
70
  :invoice_footer,
71
71
  :invoice_grace_period,
72
+ :subscription_invoice_issuing_date_anchor,
73
+ :subscription_invoice_issuing_date_adjustment,
72
74
  :document_locale,
73
75
  )
74
76
  end
75
77
 
76
78
  def whitelist_update_params(params)
77
- result_params = whitelist_create_params(params).dup
79
+ result_params = whitelist_create_params(params).dup[root_name]
78
80
 
79
81
  result_params.delete(:code)
80
82
  result_params[:tax_codes] = params[:tax_codes] if params.key?(:tax_codes)
@@ -113,6 +113,8 @@ module Lago
113
113
  def whitelist_billing_configuration(billing_params)
114
114
  (billing_params || {}).slice(
115
115
  :invoice_grace_period,
116
+ :subscription_invoice_issuing_date_anchor,
117
+ :subscription_invoice_issuing_date_adjustment,
116
118
  :payment_provider,
117
119
  :payment_provider_code,
118
120
  :provider_customer_id,
@@ -29,10 +29,9 @@ module Lago
29
29
  code: privilege[:code],
30
30
  name: privilege[:name],
31
31
  value_type: privilege[:value_type],
32
- config: {
33
- select_options: privilege[:config][:select_options],
34
- },
35
- }
32
+ }.tap do |h|
33
+ h[:config] = { select_options: privilege[:config][:select_options] } if privilege[:config]
34
+ end
36
35
  end
37
36
  end
38
37
  end
@@ -91,13 +91,12 @@ module Lago
91
91
  end
92
92
 
93
93
  def whitelist_params(params)
94
- result = {
95
- payment_status: params[:payment_status],
96
- net_payment_term: params[:net_payment_term],
97
- }
94
+ result = params.slice(:payment_status, :net_payment_term)
98
95
 
99
- metadata = whitelist_metadata(params[:metadata])
100
- result[:metadata] = metadata unless metadata.empty?
96
+ if params.key?(:metadata)
97
+ metadata = whitelist_metadata(params[:metadata])
98
+ result[:metadata] = metadata
99
+ end
101
100
 
102
101
  { root_name => result }
103
102
  end
@@ -106,9 +105,13 @@ module Lago
106
105
  processed_metadata = []
107
106
 
108
107
  metadata.each do |m|
109
- result = (m || {}).slice(:id, :key, :value)
108
+ raise ArgumentError, "metadata item must be a hash" unless m.is_a?(Hash)
109
+
110
+ result = m.slice(:id, :key, :value)
111
+ raise ArgumentError, "metadata must have key" unless result.key?(:key)
112
+ raise ArgumentError, "metadata must have value" unless result.key?(:value)
110
113
 
111
- processed_metadata << result unless result.empty?
114
+ processed_metadata << result
112
115
  end
113
116
 
114
117
  processed_metadata
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.35.0'
4
+ VERSION = '1.37.0'
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.35.0
4
+ version: 1.37.0
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-11-06 00:00:00.000000000 Z
11
+ date: 2025-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -94,6 +94,48 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: httplog
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: mutex_m
99
141
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +164,20 @@ dependencies:
122
164
  - - ">="
123
165
  - !ruby/object:Gem::Version
124
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry-byebug
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
125
181
  - !ruby/object:Gem::Dependency
126
182
  name: rake
127
183
  requirement: !ruby/object:Gem::Requirement