e-invoice-api 0.9.2 → 0.10.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 +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/lib/e_invoice_api/internal/transport/base_client.rb +7 -1
- data/lib/e_invoice_api/internal/transport/pooled_net_requester.rb +36 -26
- data/lib/e_invoice_api/version.rb +1 -1
- data/lib/e_invoice_api.rb +1 -0
- data/manifest.yaml +1 -0
- data/rbi/e_invoice_api/internal/transport/base_client.rbi +5 -0
- data/rbi/e_invoice_api/internal/transport/pooled_net_requester.rbi +6 -2
- data/rbi/e_invoice_api/internal/type/base_model.rbi +8 -4
- data/sig/e_invoice_api/internal/transport/base_client.rbs +2 -0
- data/sig/e_invoice_api/internal/transport/pooled_net_requester.rbs +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30e18d52fb05240996a7e7aca2507aaffca222ff7dda9a15b7cd01e22b8119d4
|
|
4
|
+
data.tar.gz: a13419940f9a320ad9e13eae9a2cf966b88919cd10865e20503f7b2db8ae25ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8857d7df1934fafac0467f40ad848197be8b25badb5a1816b51038c4cfed6ba7f342ef895b23e191dbf8099bded25695e354c569b11ad2a239f3c5bed9812b87
|
|
7
|
+
data.tar.gz: b2ba70f106c621ca8be4e9e6d239f72094097cb446ba13cf176e4ae4a3ef9592c44f101c771626680ce566428edf24e54bc748f902c4afe0b51b006dcc00fd8c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.1 (2025-11-05)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.10.0...v0.10.1](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.10.0...v0.10.1)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* better thread safety via early initializing SSL store during HTTP client creation ([d085426](https://github.com/e-invoice-be/e-invoice-rb/commit/d08542612d127f1914ed20172441cfe64f4c2ba6))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Chores
|
|
13
|
+
|
|
14
|
+
* bump dependency version and update sorbet types ([82b7467](https://github.com/e-invoice-be/e-invoice-rb/commit/82b74674056783e820aad541764b54808c3a80ce))
|
|
15
|
+
|
|
16
|
+
## 0.10.0 (2025-10-24)
|
|
17
|
+
|
|
18
|
+
Full Changelog: [v0.9.2...v0.10.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.9.2...v0.10.0)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* handle thread interrupts in the core HTTP client ([b750be8](https://github.com/e-invoice-be/e-invoice-rb/commit/b750be88c216cf4a73032b249684e0219942f3f7))
|
|
23
|
+
|
|
3
24
|
## 0.9.2 (2025-10-16)
|
|
4
25
|
|
|
5
26
|
Full Changelog: [v0.9.1...v0.9.2](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.9.1...v0.9.2)
|
data/README.md
CHANGED
|
@@ -201,7 +201,8 @@ module EInvoiceAPI
|
|
|
201
201
|
self.class::PLATFORM_HEADERS,
|
|
202
202
|
{
|
|
203
203
|
"accept" => "application/json",
|
|
204
|
-
"content-type" => "application/json"
|
|
204
|
+
"content-type" => "application/json",
|
|
205
|
+
"user-agent" => user_agent
|
|
205
206
|
},
|
|
206
207
|
headers
|
|
207
208
|
)
|
|
@@ -219,6 +220,11 @@ module EInvoiceAPI
|
|
|
219
220
|
# @return [Hash{String=>String}]
|
|
220
221
|
private def auth_headers = {}
|
|
221
222
|
|
|
223
|
+
# @api private
|
|
224
|
+
#
|
|
225
|
+
# @return [String]
|
|
226
|
+
private def user_agent = "#{self.class.name}/Ruby #{EInvoiceAPI::VERSION}"
|
|
227
|
+
|
|
222
228
|
# @api private
|
|
223
229
|
#
|
|
224
230
|
# @return [String]
|
|
@@ -16,10 +16,11 @@ module EInvoiceAPI
|
|
|
16
16
|
class << self
|
|
17
17
|
# @api private
|
|
18
18
|
#
|
|
19
|
+
# @param cert_store [OpenSSL::X509::Store]
|
|
19
20
|
# @param url [URI::Generic]
|
|
20
21
|
#
|
|
21
22
|
# @return [Net::HTTP]
|
|
22
|
-
def connect(url)
|
|
23
|
+
def connect(cert_store:, url:)
|
|
23
24
|
port =
|
|
24
25
|
case [url.port, url.scheme]
|
|
25
26
|
in [Integer, _]
|
|
@@ -33,6 +34,8 @@ module EInvoiceAPI
|
|
|
33
34
|
Net::HTTP.new(url.host, port).tap do
|
|
34
35
|
_1.use_ssl = %w[https wss].include?(url.scheme)
|
|
35
36
|
_1.max_retries = 0
|
|
37
|
+
|
|
38
|
+
(_1.cert_store = cert_store) if _1.use_ssl?
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
41
|
|
|
@@ -102,7 +105,7 @@ module EInvoiceAPI
|
|
|
102
105
|
pool =
|
|
103
106
|
@mutex.synchronize do
|
|
104
107
|
@pools[origin] ||= ConnectionPool.new(size: @size) do
|
|
105
|
-
self.class.connect(url)
|
|
108
|
+
self.class.connect(cert_store: @cert_store, url: url)
|
|
106
109
|
end
|
|
107
110
|
end
|
|
108
111
|
|
|
@@ -128,40 +131,48 @@ module EInvoiceAPI
|
|
|
128
131
|
url, deadline = request.fetch_values(:url, :deadline)
|
|
129
132
|
|
|
130
133
|
req = nil
|
|
131
|
-
eof = false
|
|
132
134
|
finished = false
|
|
133
|
-
closing = nil
|
|
134
135
|
|
|
135
136
|
# rubocop:disable Metrics/BlockLength
|
|
136
137
|
enum = Enumerator.new do |y|
|
|
137
138
|
next if finished
|
|
138
139
|
|
|
139
140
|
with_pool(url, deadline: deadline) do |conn|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
conn.start
|
|
148
|
-
end
|
|
141
|
+
eof = false
|
|
142
|
+
closing = nil
|
|
143
|
+
::Thread.handle_interrupt(Object => :never) do
|
|
144
|
+
::Thread.handle_interrupt(Object => :immediate) do
|
|
145
|
+
req, closing = self.class.build_request(request) do
|
|
146
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
147
|
+
end
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
rsp.read_body do |bytes|
|
|
156
|
-
y << bytes.force_encoding(Encoding::BINARY)
|
|
157
|
-
break if finished
|
|
149
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
150
|
+
unless conn.started?
|
|
151
|
+
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
|
|
152
|
+
conn.start
|
|
153
|
+
end
|
|
158
154
|
|
|
159
155
|
self.class.calibrate_socket_timeout(conn, deadline)
|
|
156
|
+
conn.request(req) do |rsp|
|
|
157
|
+
y << [req, rsp]
|
|
158
|
+
break if finished
|
|
159
|
+
|
|
160
|
+
rsp.read_body do |bytes|
|
|
161
|
+
y << bytes.force_encoding(Encoding::BINARY)
|
|
162
|
+
break if finished
|
|
163
|
+
|
|
164
|
+
self.class.calibrate_socket_timeout(conn, deadline)
|
|
165
|
+
end
|
|
166
|
+
eof = true
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
ensure
|
|
170
|
+
begin
|
|
171
|
+
conn.finish if !eof && conn&.started?
|
|
172
|
+
ensure
|
|
173
|
+
closing&.call
|
|
160
174
|
end
|
|
161
|
-
eof = true
|
|
162
175
|
end
|
|
163
|
-
ensure
|
|
164
|
-
conn.finish if !eof && conn&.started?
|
|
165
176
|
end
|
|
166
177
|
rescue Timeout::Error
|
|
167
178
|
raise EInvoiceAPI::Errors::APITimeoutError.new(url: url, request: req)
|
|
@@ -174,8 +185,6 @@ module EInvoiceAPI
|
|
|
174
185
|
body = EInvoiceAPI::Internal::Util.fused_enum(enum, external: true) do
|
|
175
186
|
finished = true
|
|
176
187
|
loop { enum.next }
|
|
177
|
-
ensure
|
|
178
|
-
closing&.call
|
|
179
188
|
end
|
|
180
189
|
[Integer(response.code), response, body]
|
|
181
190
|
end
|
|
@@ -186,6 +195,7 @@ module EInvoiceAPI
|
|
|
186
195
|
def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
|
|
187
196
|
@mutex = Mutex.new
|
|
188
197
|
@size = size
|
|
198
|
+
@cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
|
189
199
|
@pools = {}
|
|
190
200
|
end
|
|
191
201
|
|
data/lib/e_invoice_api.rb
CHANGED
data/manifest.yaml
CHANGED
|
@@ -26,8 +26,12 @@ module EInvoiceAPI
|
|
|
26
26
|
|
|
27
27
|
class << self
|
|
28
28
|
# @api private
|
|
29
|
-
sig
|
|
30
|
-
|
|
29
|
+
sig do
|
|
30
|
+
params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
|
|
31
|
+
Net::HTTP
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
def connect(cert_store:, url:)
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
# @api private
|
|
@@ -31,7 +31,7 @@ module EInvoiceAPI
|
|
|
31
31
|
#
|
|
32
32
|
# Assumes superclass fields are totally defined before fields are accessed /
|
|
33
33
|
# defined on subclasses.
|
|
34
|
-
sig { params(child:
|
|
34
|
+
sig { params(child: EInvoiceAPI::Internal::Type::BaseModel).void }
|
|
35
35
|
def inherited(child)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -276,9 +276,13 @@ module EInvoiceAPI
|
|
|
276
276
|
|
|
277
277
|
# Create a new instance of a model.
|
|
278
278
|
sig do
|
|
279
|
-
params(
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
params(
|
|
280
|
+
data:
|
|
281
|
+
T.any(
|
|
282
|
+
T::Hash[Symbol, T.anything],
|
|
283
|
+
EInvoiceAPI::Internal::Type::BaseModel
|
|
284
|
+
)
|
|
285
|
+
).returns(T.attached_class)
|
|
282
286
|
end
|
|
283
287
|
def self.new(data = {})
|
|
284
288
|
end
|
|
@@ -17,7 +17,10 @@ module EInvoiceAPI
|
|
|
17
17
|
|
|
18
18
|
DEFAULT_MAX_CONNECTIONS: Integer
|
|
19
19
|
|
|
20
|
-
def self.connect: (
|
|
20
|
+
def self.connect: (
|
|
21
|
+
cert_store: OpenSSL::X509::Store,
|
|
22
|
+
url: URI::Generic
|
|
23
|
+
) -> top
|
|
21
24
|
|
|
22
25
|
def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
|
|
23
26
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: e-invoice-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- e-invoice
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: connection_pool
|