e-invoice-api 0.5.0 → 0.5.2

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: 8499e5d0cae2a5f9bf6b83427b46cf763b5de0df6f17981dbe45251e2079e1ec
4
- data.tar.gz: 4a946717056ba3c1533b0448fd5a7cf3d177b8c2b7fffe665fdc18a1957972b0
3
+ metadata.gz: 438b75b71296823e500d9b3c1b24b6cf127222237107a15e412ac746e5bae37c
4
+ data.tar.gz: f87581a3ab2ce3616f068d8ffac4fc403de0ca488a0b02402ce16e4e1993439d
5
5
  SHA512:
6
- metadata.gz: 79934e3197eec9a699e19f201133a2edc38c5bbb52048143ab6c08e124366c9f80e5fad928759b4f8c5ab0efb96d117d624f968850e19a94ab9b2824c6196356
7
- data.tar.gz: c180a7b76f5b2de21fae67d8484c78d17eca2c8fde15fee43fa54cb7df29a95ca5a998d05d1b7dbed9ed54fc76bfc1dae04f16a28c3a171c83ea3ec23e15d5aa
6
+ metadata.gz: eeb1f588e88631e17d59b10706dc237c34f035d448cf66502a261eb0bb9b0704ebf1108c841029c5c7e45f32bd7935eed700953e2d791e3403d47f7495a094ea
7
+ data.tar.gz: 7d07de513ce62e598f7cac78f9784992fbc51857ff5a0f7c10d827f82989bec611b3b6aa5e96d9ec941d699a8d666d724585969465783573b9b59bf4ef092eb8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2 (2025-09-30)
4
+
5
+ Full Changelog: [v0.5.1...v0.5.2](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.5.1...v0.5.2)
6
+
7
+ ### Bug Fixes
8
+
9
+ * always send `filename=...` for multipart requests where a file is expected ([e4ff666](https://github.com/e-invoice-be/e-invoice-rb/commit/e4ff6665e73982d21afb468a3b14dc9a4e9ac404))
10
+
11
+
12
+ ### Chores
13
+
14
+ * allow fast-format to use bsd sed as well ([bfe57c8](https://github.com/e-invoice-be/e-invoice-rb/commit/bfe57c8ef9ccd2875fdf93180009f2f98fcdba7b))
15
+
16
+ ## 0.5.1 (2025-09-27)
17
+
18
+ Full Changelog: [v0.5.0...v0.5.1](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.5.0...v0.5.1)
19
+
20
+ ### Bug Fixes
21
+
22
+ * shorten multipart boundary sep to less than RFC specificed max length ([336fbe2](https://github.com/e-invoice-be/e-invoice-rb/commit/336fbe2d7932708e0ac0eb3d6f2d96bfa52cf165))
23
+
24
+
25
+ ### Performance Improvements
26
+
27
+ * faster code formatting ([1180d4a](https://github.com/e-invoice-be/e-invoice-rb/commit/1180d4a4ebcca49f99aa860ecdb88ea312d25fb6))
28
+
29
+
30
+ ### Chores
31
+
32
+ * **internal:** codegen related update ([c4a13d4](https://github.com/e-invoice-be/e-invoice-rb/commit/c4a13d47fa4210a2e0849a5b94a53d3fdc26e7d4))
33
+
3
34
  ## 0.5.0 (2025-09-23)
4
35
 
5
36
  Full Changelog: [v0.4.0...v0.5.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.4.0...v0.5.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "e-invoice-api", "~> 0.5.0"
20
+ gem "e-invoice-api", "~> 0.5.2"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -38,18 +38,21 @@ module EInvoiceAPI
38
38
  def to_yaml(*a) = read.to_yaml(*a)
39
39
 
40
40
  # @param content [Pathname, StringIO, IO, String]
41
- # @param filename [String, nil]
41
+ # @param filename [Pathname, String, nil]
42
42
  # @param content_type [String, nil]
43
43
  def initialize(content, filename: nil, content_type: nil)
44
- @content = content
44
+ @content_type = content_type
45
45
  @filename =
46
- case content
47
- in Pathname
48
- filename.nil? ? content.basename.to_path : ::File.basename(filename)
46
+ case [filename, (@content = content)]
47
+ in [String | Pathname, _]
48
+ ::File.basename(filename)
49
+ in [nil, Pathname]
50
+ content.basename.to_path
51
+ in [nil, IO]
52
+ content.to_path
49
53
  else
50
- filename.nil? ? nil : ::File.basename(filename)
54
+ filename
51
55
  end
52
- @content_type = content_type
53
56
  end
54
57
  end
55
58
  end
@@ -82,17 +82,20 @@ module EInvoiceAPI
82
82
  #
83
83
  # @return [Pathname, StringIO, IO, String, Object]
84
84
  def dump(value, state:)
85
- # rubocop:disable Lint/DuplicateBranch
86
85
  case value
86
+ in StringIO | String
87
+ # https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
88
+ # while not required, a filename is recommended, and in practice many servers do expect this
89
+ EInvoiceAPI::FilePart.new(value, filename: "upload")
87
90
  in IO
88
91
  state[:can_retry] = false
92
+ value.to_path.nil? ? EInvoiceAPI::FilePart.new(value, filename: "upload") : value
89
93
  in EInvoiceAPI::FilePart if value.content.is_a?(IO)
90
94
  state[:can_retry] = false
95
+ value
91
96
  else
97
+ value
92
98
  end
93
- # rubocop:enable Lint/DuplicateBranch
94
-
95
- value
96
99
  end
97
100
 
98
101
  # @api private
@@ -566,7 +566,8 @@ module EInvoiceAPI
566
566
  #
567
567
  # @return [Array(String, Enumerable<String>)]
568
568
  private def encode_multipart_streaming(body)
569
- boundary = SecureRandom.urlsafe_base64(60)
569
+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
+ boundary = SecureRandom.urlsafe_base64(46)
570
571
 
571
572
  closing = []
572
573
  strio = writable_enum do |y|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EInvoiceAPI
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.2"
5
5
  end
@@ -27,7 +27,7 @@ module EInvoiceAPI
27
27
  sig do
28
28
  params(
29
29
  content: T.any(Pathname, StringIO, IO, String),
30
- filename: T.nilable(String),
30
+ filename: T.nilable(T.any(Pathname, String)),
31
31
  content_type: T.nilable(String)
32
32
  ).returns(T.attached_class)
33
33
  end
@@ -14,7 +14,7 @@ module EInvoiceAPI
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end
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.5.0
4
+ version: 0.5.2
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-09-23 00:00:00.000000000 Z
11
+ date: 2025-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool