e-invoice-api 0.26.2 → 0.26.4

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: c7d290f34c964dc16393d7ccac540f560a4dd5833a4ad6b2cbdb2caeb8d75fa3
4
- data.tar.gz: d766d2717329f1b7228f30e893f528eb8ea505fff0ebace0f5c7be1bf6a519a6
3
+ metadata.gz: 578c3a59e0349ed164cab7de8cb2aba01ec90f1d42b97b4bfb202fbe0dbc727b
4
+ data.tar.gz: 05c14fdb79d32927a05a0e101708de8fa85aa656a6447f5c5d893a0fd4d96a44
5
5
  SHA512:
6
- metadata.gz: d2504a9927b38296e4a98ac694930b46ec8a61a57c941d768618e0abc8902bb247ef8b854b948fd91c8cee0d6dcd16db7cbd5944788c15b87395a0207b3b5341
7
- data.tar.gz: 76a7607632b3beeef4953ad4fd942d2bf7559df5fad5ef6952294cfb36e7da45e3744cbf32d8648f2f17825baa89440d0d3f26a0ad9dca70b526606e7564ae89
6
+ metadata.gz: f645ec9563dd8adcd348ed9bf5820ff672d9aabf06dcc7aaaa8ba5f9a9f638011480aa80b867023521339f1eae89f61fe6c145a9a01c8c09a399656b7c1fbf5a
7
+ data.tar.gz: 3fd14537d626916c42008cd72afb90c284378a02490bbfcc1b27050945a29d14254e9e1a7e01d69cd23625625707f8a6d6169ab1af31289c83e8fb7e0fdf584b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.26.4 (2026-04-09)
4
+
5
+ Full Changelog: [v0.26.3...v0.26.4](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.26.3...v0.26.4)
6
+
7
+ ### Bug Fixes
8
+
9
+ * multipart encoding for file arrays ([77874cb](https://github.com/e-invoice-be/e-invoice-rb/commit/77874cb9a28df936f4e019d601874c8f15108349))
10
+
11
+ ## 0.26.3 (2026-04-01)
12
+
13
+ Full Changelog: [v0.26.2...v0.26.3](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.26.2...v0.26.3)
14
+
15
+ ### Bug Fixes
16
+
17
+ * align path encoding with RFC 3986 section 3.3 ([8e0aa33](https://github.com/e-invoice-be/e-invoice-rb/commit/8e0aa333af64b16c5c5de9092f810696beda0bd4))
18
+
3
19
  ## 0.26.2 (2026-04-01)
4
20
 
5
21
  Full Changelog: [v0.26.1...v0.26.2](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.26.1...v0.26.2)
data/README.md CHANGED
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
26
26
  <!-- x-release-please-start-version -->
27
27
 
28
28
  ```ruby
29
- gem "e-invoice-api", "~> 0.26.2"
29
+ gem "e-invoice-api", "~> 0.26.4"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -237,6 +237,11 @@ module EInvoiceAPI
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module EInvoiceAPI
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(EInvoiceAPI::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module EInvoiceAPI
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -576,10 +590,10 @@ module EInvoiceAPI
576
590
 
577
591
  case val
578
592
  in EInvoiceAPI::FilePart unless val.filename.nil?
579
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
580
594
  y << "; filename=\"#{filename}\""
581
595
  in Pathname | IO
582
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
583
597
  y << "; filename=\"#{filename}\""
584
598
  else
585
599
  end
@@ -596,6 +610,7 @@ module EInvoiceAPI
596
610
  #
597
611
  # @return [Array(String, Enumerable<String>)]
598
612
  private def encode_multipart_streaming(body)
613
+ # rubocop:disable Style/CaseEquality
599
614
  # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
600
615
  boundary = SecureRandom.urlsafe_base64(46)
601
616
 
@@ -605,7 +620,7 @@ module EInvoiceAPI
605
620
  in Hash
606
621
  body.each do |key, val|
607
622
  case val
608
- in Array if val.all? { primitive?(_1) }
623
+ in Array if val.all? { primitive?(_1) || EInvoiceAPI::Internal::Type::FileInput === _1 }
609
624
  val.each do |v|
610
625
  write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
611
626
  end
@@ -621,6 +636,7 @@ module EInvoiceAPI
621
636
 
622
637
  fused_io = fused_enum(strio) { closing.each(&:call) }
623
638
  [boundary, fused_io]
639
+ # rubocop:enable Style/CaseEquality
624
640
  end
625
641
 
626
642
  # @api private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EInvoiceAPI
4
- VERSION = "0.26.2"
4
+ VERSION = "0.26.4"
5
5
  end
@@ -148,12 +148,20 @@ module EInvoiceAPI
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -45,8 +45,12 @@ module EInvoiceAPI
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
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.26.2
4
+ version: 0.26.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - e-invoice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-01 00:00:00.000000000 Z
11
+ date: 2026-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi