e-invoice-api 0.3.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +1 -1
- data/lib/e_invoice_api/errors.rb +25 -11
- data/lib/e_invoice_api/internal/documents_number_page.rb +1 -1
- data/lib/e_invoice_api/internal/transport/base_client.rb +11 -7
- data/lib/e_invoice_api/internal/type/base_page.rb +1 -1
- data/lib/e_invoice_api/internal/util.rb +1 -1
- data/lib/e_invoice_api/models/unit_of_measure_code.rb +941 -1
- data/lib/e_invoice_api/resources/inbox.rb +2 -1
- data/lib/e_invoice_api/resources/outbox.rb +2 -1
- data/lib/e_invoice_api/version.rb +1 -1
- data/rbi/e_invoice_api/errors.rbi +29 -2
- data/rbi/e_invoice_api/internal/transport/base_client.rbi +4 -5
- data/rbi/e_invoice_api/internal/type/base_page.rbi +1 -1
- data/rbi/e_invoice_api/internal/util.rbi +1 -1
- data/rbi/e_invoice_api/models/unit_of_measure_code.rbi +977 -1
- data/rbi/e_invoice_api/resources/inbox.rbi +2 -1
- data/rbi/e_invoice_api/resources/outbox.rbi +2 -1
- data/sig/e_invoice_api/errors.rbs +7 -0
- data/sig/e_invoice_api/models/unit_of_measure_code.rbs +1882 -2
- 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: 8499e5d0cae2a5f9bf6b83427b46cf763b5de0df6f17981dbe45251e2079e1ec
|
4
|
+
data.tar.gz: 4a946717056ba3c1533b0448fd5a7cf3d177b8c2b7fffe665fdc18a1957972b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79934e3197eec9a699e19f201133a2edc38c5bbb52048143ab6c08e124366c9f80e5fad928759b4f8c5ab0efb96d117d624f968850e19a94ab9b2824c6196356
|
7
|
+
data.tar.gz: c180a7b76f5b2de21fae67d8484c78d17eca2c8fde15fee43fa54cb7df29a95ca5a998d05d1b7dbed9ed54fc76bfc1dae04f16a28c3a171c83ea3ec23e15d5aa
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.0 (2025-09-23)
|
4
|
+
|
5
|
+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.4.0...v0.5.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** api update ([34569bc](https://github.com/e-invoice-be/e-invoice-rb/commit/34569bc552219bee2c829c83f5f702c0bb07954f))
|
10
|
+
* expose response headers for both streams and errors ([060ee53](https://github.com/e-invoice-be/e-invoice-rb/commit/060ee535da0a4f4c7cc2ed22c88c05793ce48d79))
|
11
|
+
|
12
|
+
|
13
|
+
### Chores
|
14
|
+
|
15
|
+
* do not install brew dependencies in ./scripts/bootstrap by default ([7e7229e](https://github.com/e-invoice-be/e-invoice-rb/commit/7e7229e7d4296da7b82cd2d4d042e74a28a19aa9))
|
16
|
+
|
17
|
+
## 0.4.0 (2025-09-16)
|
18
|
+
|
19
|
+
Full Changelog: [v0.3.0...v0.4.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.3.0...v0.4.0)
|
20
|
+
|
21
|
+
### Features
|
22
|
+
|
23
|
+
* **api:** api update ([c79c3df](https://github.com/e-invoice-be/e-invoice-rb/commit/c79c3df2cc36e34fcda97c1d4a52bbe994c2e563))
|
24
|
+
|
3
25
|
## 0.3.0 (2025-09-02)
|
4
26
|
|
5
27
|
Full Changelog: [v0.2.7...v0.3.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.2.7...v0.3.0)
|
data/README.md
CHANGED
data/lib/e_invoice_api/errors.rb
CHANGED
@@ -40,6 +40,9 @@ module EInvoiceAPI
|
|
40
40
|
# @return [Integer, nil]
|
41
41
|
attr_accessor :status
|
42
42
|
|
43
|
+
# @return [Hash{String=>String}, nil]
|
44
|
+
attr_accessor :headers
|
45
|
+
|
43
46
|
# @return [Object, nil]
|
44
47
|
attr_accessor :body
|
45
48
|
|
@@ -47,13 +50,15 @@ module EInvoiceAPI
|
|
47
50
|
#
|
48
51
|
# @param url [URI::Generic]
|
49
52
|
# @param status [Integer, nil]
|
53
|
+
# @param headers [Hash{String=>String}, nil]
|
50
54
|
# @param body [Object, nil]
|
51
55
|
# @param request [nil]
|
52
56
|
# @param response [nil]
|
53
57
|
# @param message [String, nil]
|
54
|
-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
|
58
|
+
def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
|
55
59
|
@url = url
|
56
60
|
@status = status
|
61
|
+
@headers = headers
|
57
62
|
@body = body
|
58
63
|
@request = request
|
59
64
|
@response = response
|
@@ -74,6 +79,7 @@ module EInvoiceAPI
|
|
74
79
|
#
|
75
80
|
# @param url [URI::Generic]
|
76
81
|
# @param status [nil]
|
82
|
+
# @param headers [Hash{String=>String}, nil]
|
77
83
|
# @param body [nil]
|
78
84
|
# @param request [nil]
|
79
85
|
# @param response [nil]
|
@@ -81,6 +87,7 @@ module EInvoiceAPI
|
|
81
87
|
def initialize(
|
82
88
|
url:,
|
83
89
|
status: nil,
|
90
|
+
headers: nil,
|
84
91
|
body: nil,
|
85
92
|
request: nil,
|
86
93
|
response: nil,
|
@@ -95,6 +102,7 @@ module EInvoiceAPI
|
|
95
102
|
#
|
96
103
|
# @param url [URI::Generic]
|
97
104
|
# @param status [nil]
|
105
|
+
# @param headers [Hash{String=>String}, nil]
|
98
106
|
# @param body [nil]
|
99
107
|
# @param request [nil]
|
100
108
|
# @param response [nil]
|
@@ -102,6 +110,7 @@ module EInvoiceAPI
|
|
102
110
|
def initialize(
|
103
111
|
url:,
|
104
112
|
status: nil,
|
113
|
+
headers: nil,
|
105
114
|
body: nil,
|
106
115
|
request: nil,
|
107
116
|
response: nil,
|
@@ -116,21 +125,24 @@ module EInvoiceAPI
|
|
116
125
|
#
|
117
126
|
# @param url [URI::Generic]
|
118
127
|
# @param status [Integer]
|
128
|
+
# @param headers [Hash{String=>String}, nil]
|
119
129
|
# @param body [Object, nil]
|
120
130
|
# @param request [nil]
|
121
131
|
# @param response [nil]
|
122
132
|
# @param message [String, nil]
|
123
133
|
#
|
124
134
|
# @return [self]
|
125
|
-
def self.for(url:, status:, body:, request:, response:, message: nil)
|
126
|
-
kwargs =
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
135
|
+
def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
|
136
|
+
kwargs =
|
137
|
+
{
|
138
|
+
url: url,
|
139
|
+
status: status,
|
140
|
+
headers: headers,
|
141
|
+
body: body,
|
142
|
+
request: request,
|
143
|
+
response: response,
|
144
|
+
message: message
|
145
|
+
}
|
134
146
|
|
135
147
|
case status
|
136
148
|
in 400
|
@@ -162,15 +174,17 @@ module EInvoiceAPI
|
|
162
174
|
#
|
163
175
|
# @param url [URI::Generic]
|
164
176
|
# @param status [Integer]
|
177
|
+
# @param headers [Hash{String=>String}, nil]
|
165
178
|
# @param body [Object, nil]
|
166
179
|
# @param request [nil]
|
167
180
|
# @param response [nil]
|
168
181
|
# @param message [String, nil]
|
169
|
-
def initialize(url:, status:, body:, request:, response:, message: nil)
|
182
|
+
def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
|
170
183
|
message ||= {url: url.to_s, status: status, body: body}
|
171
184
|
super(
|
172
185
|
url: url,
|
173
186
|
status: status,
|
187
|
+
headers: headers,
|
174
188
|
body: body,
|
175
189
|
request: request,
|
176
190
|
response: response,
|
@@ -66,7 +66,7 @@ module EInvoiceAPI
|
|
66
66
|
#
|
67
67
|
# @param client [EInvoiceAPI::Internal::Transport::BaseClient]
|
68
68
|
# @param req [Hash{Symbol=>Object}]
|
69
|
-
# @param headers [Hash{String=>String}
|
69
|
+
# @param headers [Hash{String=>String}]
|
70
70
|
# @param page_data [Hash{Symbol=>Object}]
|
71
71
|
def initialize(client:, req:, headers:, page_data:)
|
72
72
|
super
|
@@ -47,7 +47,7 @@ module EInvoiceAPI
|
|
47
47
|
# @api private
|
48
48
|
#
|
49
49
|
# @param status [Integer]
|
50
|
-
# @param headers [Hash{String=>String}
|
50
|
+
# @param headers [Hash{String=>String}]
|
51
51
|
#
|
52
52
|
# @return [Boolean]
|
53
53
|
def should_retry?(status, headers:)
|
@@ -85,7 +85,7 @@ module EInvoiceAPI
|
|
85
85
|
#
|
86
86
|
# @param status [Integer]
|
87
87
|
#
|
88
|
-
# @param response_headers [Hash{String=>String}
|
88
|
+
# @param response_headers [Hash{String=>String}]
|
89
89
|
#
|
90
90
|
# @return [Hash{Symbol=>Object}]
|
91
91
|
def follow_redirect(request, status:, response_headers:)
|
@@ -378,6 +378,7 @@ module EInvoiceAPI
|
|
378
378
|
rescue EInvoiceAPI::Errors::APIConnectionError => e
|
379
379
|
status = e
|
380
380
|
end
|
381
|
+
headers = EInvoiceAPI::Internal::Util.normalized_headers(response&.each_header&.to_h)
|
381
382
|
|
382
383
|
case status
|
383
384
|
in ..299
|
@@ -390,7 +391,7 @@ module EInvoiceAPI
|
|
390
391
|
in 300..399
|
391
392
|
self.class.reap_connection!(status, stream: stream)
|
392
393
|
|
393
|
-
request = self.class.follow_redirect(request, status: status, response_headers:
|
394
|
+
request = self.class.follow_redirect(request, status: status, response_headers: headers)
|
394
395
|
send_request(
|
395
396
|
request,
|
396
397
|
redirect_count: redirect_count + 1,
|
@@ -399,9 +400,9 @@ module EInvoiceAPI
|
|
399
400
|
)
|
400
401
|
in EInvoiceAPI::Errors::APIConnectionError if retry_count >= max_retries
|
401
402
|
raise status
|
402
|
-
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers:
|
403
|
+
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
|
403
404
|
decoded = Kernel.then do
|
404
|
-
EInvoiceAPI::Internal::Util.decode_content(
|
405
|
+
EInvoiceAPI::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
|
405
406
|
ensure
|
406
407
|
self.class.reap_connection!(status, stream: stream)
|
407
408
|
end
|
@@ -409,6 +410,7 @@ module EInvoiceAPI
|
|
409
410
|
raise EInvoiceAPI::Errors::APIStatusError.for(
|
410
411
|
url: url,
|
411
412
|
status: status,
|
413
|
+
headers: headers,
|
412
414
|
body: decoded,
|
413
415
|
request: nil,
|
414
416
|
response: response
|
@@ -485,19 +487,21 @@ module EInvoiceAPI
|
|
485
487
|
send_retry_header: send_retry_header
|
486
488
|
)
|
487
489
|
|
488
|
-
|
490
|
+
headers = EInvoiceAPI::Internal::Util.normalized_headers(response.each_header.to_h)
|
491
|
+
decoded = EInvoiceAPI::Internal::Util.decode_content(headers, stream: stream)
|
489
492
|
case req
|
490
493
|
in {stream: Class => st}
|
491
494
|
st.new(
|
492
495
|
model: model,
|
493
496
|
url: url,
|
494
497
|
status: status,
|
498
|
+
headers: headers,
|
495
499
|
response: response,
|
496
500
|
unwrap: unwrap,
|
497
501
|
stream: decoded
|
498
502
|
)
|
499
503
|
in {page: Class => page}
|
500
|
-
page.new(client: self, req: req, headers:
|
504
|
+
page.new(client: self, req: req, headers: headers, page_data: decoded)
|
501
505
|
else
|
502
506
|
unwrapped = EInvoiceAPI::Internal::Util.dig(decoded, unwrap)
|
503
507
|
EInvoiceAPI::Internal::Type::Converter.coerce(model, unwrapped)
|
@@ -39,7 +39,7 @@ module EInvoiceAPI
|
|
39
39
|
#
|
40
40
|
# @param client [EInvoiceAPI::Internal::Transport::BaseClient]
|
41
41
|
# @param req [Hash{Symbol=>Object}]
|
42
|
-
# @param headers [Hash{String=>String}
|
42
|
+
# @param headers [Hash{String=>String}]
|
43
43
|
# @param page_data [Object]
|
44
44
|
def initialize(client:, req:, headers:, page_data:)
|
45
45
|
@client = client
|
@@ -647,7 +647,7 @@ module EInvoiceAPI
|
|
647
647
|
#
|
648
648
|
# Assumes each chunk in stream has `Encoding::BINARY`.
|
649
649
|
#
|
650
|
-
# @param headers [Hash{String=>String}
|
650
|
+
# @param headers [Hash{String=>String}]
|
651
651
|
# @param stream [Enumerable<String>]
|
652
652
|
# @param suppress_error [Boolean]
|
653
653
|
#
|