e-invoice-api 0.34.0 → 0.35.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 +23 -0
- data/LICENSE +201 -0
- data/README.md +18 -7
- data/SECURITY.md +6 -16
- data/lib/e_invoice_api/internal/transport/base_client.rb +43 -78
- data/lib/e_invoice_api/internal/transport/pooled_net_requester.rb +8 -8
- data/lib/e_invoice_api/internal/type/array_of.rb +12 -12
- data/lib/e_invoice_api/internal/type/base_model.rb +18 -18
- data/lib/e_invoice_api/internal/type/boolean.rb +6 -6
- data/lib/e_invoice_api/internal/type/converter.rb +24 -24
- data/lib/e_invoice_api/internal/type/enum.rb +6 -6
- data/lib/e_invoice_api/internal/type/file_input.rb +6 -6
- data/lib/e_invoice_api/internal/type/hash_of.rb +12 -12
- data/lib/e_invoice_api/internal/type/request_parameters.rb +1 -1
- data/lib/e_invoice_api/internal/type/union.rb +10 -10
- data/lib/e_invoice_api/internal/type/unknown.rb +6 -6
- data/lib/e_invoice_api/internal/util.rb +15 -57
- data/lib/e_invoice_api/models/document_create.rb +45 -12
- data/lib/e_invoice_api/models/document_create_from_pdf_response.rb +45 -12
- data/lib/e_invoice_api/models/document_response.rb +49 -14
- data/lib/e_invoice_api/models/payment_detail_create.rb +4 -2
- data/lib/e_invoice_api/models/unit_of_measure_code.rb +1349 -0
- data/lib/e_invoice_api/resources/conversion/pdf.rb +6 -6
- data/lib/e_invoice_api/resources/documents/attachments.rb +11 -11
- data/lib/e_invoice_api/resources/documents/ubl.rb +4 -4
- data/lib/e_invoice_api/resources/documents.rb +81 -81
- data/lib/e_invoice_api/resources/drafts.rb +10 -10
- data/lib/e_invoice_api/resources/inbox.rb +20 -20
- data/lib/e_invoice_api/resources/lookup.rb +5 -5
- data/lib/e_invoice_api/resources/mailbox.rb +17 -17
- data/lib/e_invoice_api/resources/me.rb +1 -1
- data/lib/e_invoice_api/resources/outbox.rb +19 -19
- data/lib/e_invoice_api/resources/stats.rb +4 -4
- data/lib/e_invoice_api/resources/validate.rb +63 -63
- data/lib/e_invoice_api/resources/webhooks.rb +20 -20
- data/lib/e_invoice_api/version.rb +1 -1
- data/lib/e_invoice_api.rb +0 -1
- data/rbi/e_invoice_api/internal/transport/base_client.rbi +2 -10
- data/rbi/e_invoice_api/internal/util.rbi +0 -12
- data/rbi/e_invoice_api/models/document_create.rbi +156 -12
- data/rbi/e_invoice_api/models/document_create_from_pdf_response.rbi +156 -12
- data/rbi/e_invoice_api/models/document_response.rbi +162 -14
- data/rbi/e_invoice_api/models/payment_detail_create.rbi +6 -2
- data/rbi/e_invoice_api/models/unit_of_measure_code.rbi +1349 -0
- data/rbi/e_invoice_api/resources/documents.rbi +10 -5
- data/rbi/e_invoice_api/resources/validate.rbi +8 -5
- data/sig/e_invoice_api/internal/transport/base_client.rbs +1 -4
- data/sig/e_invoice_api/internal/util.rbs +0 -4
- data/sig/e_invoice_api/models/document_create.rbs +52 -0
- data/sig/e_invoice_api/models/document_create_from_pdf_response.rbs +52 -0
- data/sig/e_invoice_api/models/document_response.rbs +52 -0
- data/sig/e_invoice_api/models/unit_of_measure_code.rbs +2698 -0
- metadata +27 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2eb2e2ffdbc2f51e90b910c660777e04bc11340dfc86b8f0f4841dafd809fab2
|
|
4
|
+
data.tar.gz: bb59e3f10e1994ed244ecf64c327057f734def70989f05a1c986b1182bd3bb56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b4695e3f542f4f8e049b94a6661708495db40f64df9453b17744bc05efd04c4110a8670f2a6cd5d4317546528558eb80747378e36da3e4733284caa13fbc3f3
|
|
7
|
+
data.tar.gz: 7cf803f0bb4e2682bf21b7b88e18f61ec5cf74165d94e1fba08b8956206f5dbc7a7f8b9f5d1a2c960cb5895edcc7611cfb28805ce8c79fb9669257d7fdb4e623
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.35.0 (2026-11-19)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.34.0...v0.35.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.34.0...v0.35.0)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* Requests no longer send the `x-stainless-arch`, `x-stainless-lang`, `x-stainless-os`, `x-stainless-package-version`, `x-stainless-runtime`, `x-stainless-runtime-version`, `x-stainless-retry-count` and `x-stainless-timeout` headers. The `User-Agent` header stays. Retries work as before.
|
|
10
|
+
* Generated idempotency keys start with `e-invoice-ruby-retry-` instead of `stainless-ruby-retry-`. `EInvoiceAPI::Client` sends no idempotency header by default, so this only affects code that sets one.
|
|
11
|
+
* Removed `EInvoiceAPI::Internal::Util.arch`, `EInvoiceAPI::Internal::Util.os` and the `EInvoiceAPI::Internal::Transport::BaseClient::PLATFORM_HEADERS` constant, and the `send_retry_header:` keyword of `BaseClient#send_request`. They only served these headers.
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **api:** sync SDK with live OpenAPI spec: 1349 more `UnitOfMeasureCode` values, 26 more VAT exemption codes (`Vatex`), updated field descriptions ([#95](https://github.com/e-invoice-be/e-invoice-rb/issues/95)) ([5d02703](https://github.com/e-invoice-be/e-invoice-rb/commit/5d027039a57bf323d12e7808e62a468ccac0031e))
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* load on Ruby 3.4 without base64, check undeclared gem dependencies ([#91](https://github.com/e-invoice-be/e-invoice-rb/issues/91)) ([b874aa0](https://github.com/e-invoice-be/e-invoice-rb/commit/b874aa0dc75cd82ecb69c15a2a984136d402dcc2))
|
|
20
|
+
* show yard @option tags as option lists and keep brace types ([#90](https://github.com/e-invoice-be/e-invoice-rb/issues/90)) ([476ebe0](https://github.com/e-invoice-be/e-invoice-rb/commit/476ebe064821fc62e50892db4d1148285c25272b))
|
|
21
|
+
|
|
22
|
+
### Chores
|
|
23
|
+
|
|
24
|
+
* Remove the Stainless leftovers: the SDK is now maintained by e-invoice.be ([#92](https://github.com/e-invoice-be/e-invoice-rb/issues/92))
|
|
25
|
+
|
|
3
26
|
## 0.34.0 (2026-11-03)
|
|
4
27
|
|
|
5
28
|
Full Changelog: [v0.33.0...v0.34.0](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.33.0...v0.34.0)
|
data/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 E Invoice
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/README.md
CHANGED
|
@@ -9,7 +9,22 @@ To get an API key, [make a free account](https://app.e-invoice.be/register?ref=r
|
|
|
9
9
|
Use the E Invoice MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
|
|
10
10
|
|
|
11
11
|
[](https://cursor.com/en-US/install-mcp?name=e-invoice-api-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImUtaW52b2ljZS1hcGktbWNwIl0sImVudiI6eyJFX0lOVk9JQ0VfQVBJX0tFWSI6Ik15IEFQSSBLZXkifX0)
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
In VS Code, add the server to `.vscode/mcp.json` in your workspace (or to your user configuration):
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"servers": {
|
|
18
|
+
"e-invoice-api-mcp": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["-y", "e-invoice-api-mcp"],
|
|
21
|
+
"env": {
|
|
22
|
+
"E_INVOICE_API_KEY": "My API Key"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
13
28
|
|
|
14
29
|
> Note: You may need to set environment variables in your MCP client.
|
|
15
30
|
|
|
@@ -23,14 +38,10 @@ The full REST API documentation can be found on [api.e-invoice.be](https://api.e
|
|
|
23
38
|
|
|
24
39
|
To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
|
|
25
40
|
|
|
26
|
-
<!-- x-release-please-start-version -->
|
|
27
|
-
|
|
28
41
|
```ruby
|
|
29
|
-
gem "e-invoice-api", "~> 0.
|
|
42
|
+
gem "e-invoice-api", "~> 0.35.0"
|
|
30
43
|
```
|
|
31
44
|
|
|
32
|
-
<!-- x-release-please-end -->
|
|
33
|
-
|
|
34
45
|
## Usage
|
|
35
46
|
|
|
36
47
|
```ruby
|
|
@@ -291,4 +302,4 @@ Ruby 3.2.0 or higher.
|
|
|
291
302
|
|
|
292
303
|
## Contributing
|
|
293
304
|
|
|
294
|
-
See [the contributing documentation](https://github.com/e-invoice-be/e-invoice-rb/tree/main/CONTRIBUTING.md).
|
|
305
|
+
e-invoice.be maintains this SDK. See [the contributing documentation](https://github.com/e-invoice-be/e-invoice-rb/tree/main/CONTRIBUTING.md). To report a security problem, see [the security policy](https://github.com/e-invoice-be/e-invoice-rb/tree/main/SECURITY.md).
|
data/SECURITY.md
CHANGED
|
@@ -2,26 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Reporting Security Issues
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
e-invoice.be maintains this SDK. We take security seriously, and we encourage you to report any security vulnerability promptly so that we can take appropriate action.
|
|
6
6
|
|
|
7
|
-
To report a security issue
|
|
7
|
+
To report a security issue in this SDK or in the e-invoice.be services, send an email to security@e-invoice.be. Do not open a public GitHub issue.
|
|
8
8
|
|
|
9
9
|
## Responsible Disclosure
|
|
10
10
|
|
|
11
|
-
We appreciate the efforts of security researchers and individuals who help us
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
before making any information public.
|
|
15
|
-
|
|
16
|
-
## Reporting Non-SDK Related Security Issues
|
|
17
|
-
|
|
18
|
-
If you encounter security issues that are not directly related to SDKs but pertain to the services
|
|
19
|
-
or products provided by E Invoice, please follow the respective company's security reporting guidelines.
|
|
20
|
-
|
|
21
|
-
### E Invoice Terms and Policies
|
|
22
|
-
|
|
23
|
-
Please contact security@e-invoice.be for any questions or concerns regarding the security of our services.
|
|
11
|
+
We appreciate the efforts of security researchers and individuals who help us keep this SDK and our services secure.
|
|
12
|
+
If you believe you have found a security vulnerability, please adhere to responsible disclosure practices by allowing
|
|
13
|
+
us a reasonable amount of time to investigate and address the issue before making any information public.
|
|
24
14
|
|
|
25
15
|
---
|
|
26
16
|
|
|
27
|
-
Thank you for helping us keep the
|
|
17
|
+
Thank you for helping us keep the SDK and the systems it interacts with secure.
|
|
@@ -12,18 +12,6 @@ module EInvoiceAPI
|
|
|
12
12
|
# from whatwg fetch spec
|
|
13
13
|
MAX_REDIRECTS = 20
|
|
14
14
|
|
|
15
|
-
# rubocop:disable Style/MutableConstant
|
|
16
|
-
PLATFORM_HEADERS =
|
|
17
|
-
{
|
|
18
|
-
"x-stainless-arch" => EInvoiceAPI::Internal::Util.arch,
|
|
19
|
-
"x-stainless-lang" => "ruby",
|
|
20
|
-
"x-stainless-os" => EInvoiceAPI::Internal::Util.os,
|
|
21
|
-
"x-stainless-package-version" => EInvoiceAPI::VERSION,
|
|
22
|
-
"x-stainless-runtime" => ::RUBY_ENGINE,
|
|
23
|
-
"x-stainless-runtime-version" => ::RUBY_ENGINE_VERSION
|
|
24
|
-
}
|
|
25
|
-
# rubocop:enable Style/MutableConstant
|
|
26
|
-
|
|
27
15
|
class << self
|
|
28
16
|
# @api private
|
|
29
17
|
#
|
|
@@ -71,17 +59,17 @@ module EInvoiceAPI
|
|
|
71
59
|
#
|
|
72
60
|
# @param request [Hash{Symbol=>Object}] .
|
|
73
61
|
#
|
|
74
|
-
#
|
|
62
|
+
# @option request [Symbol] :method
|
|
75
63
|
#
|
|
76
|
-
#
|
|
64
|
+
# @option request [URI::Generic] :url
|
|
77
65
|
#
|
|
78
|
-
#
|
|
66
|
+
# @option request [Hash{String=>String}] :headers
|
|
79
67
|
#
|
|
80
|
-
#
|
|
68
|
+
# @option request [Object] :body
|
|
81
69
|
#
|
|
82
|
-
#
|
|
70
|
+
# @option request [Integer] :max_retries
|
|
83
71
|
#
|
|
84
|
-
#
|
|
72
|
+
# @option request [Float] :timeout
|
|
85
73
|
#
|
|
86
74
|
# @param status [Integer]
|
|
87
75
|
#
|
|
@@ -198,7 +186,6 @@ module EInvoiceAPI
|
|
|
198
186
|
)
|
|
199
187
|
@requester = EInvoiceAPI::Internal::Transport::PooledNetRequester.new
|
|
200
188
|
@headers = EInvoiceAPI::Internal::Util.normalized_headers(
|
|
201
|
-
self.class::PLATFORM_HEADERS,
|
|
202
189
|
{
|
|
203
190
|
"accept" => "application/json",
|
|
204
191
|
"content-type" => "application/json",
|
|
@@ -228,43 +215,43 @@ module EInvoiceAPI
|
|
|
228
215
|
# @api private
|
|
229
216
|
#
|
|
230
217
|
# @return [String]
|
|
231
|
-
private def generate_idempotency_key = "
|
|
218
|
+
private def generate_idempotency_key = "e-invoice-ruby-retry-#{SecureRandom.uuid}"
|
|
232
219
|
|
|
233
220
|
# @api private
|
|
234
221
|
#
|
|
235
222
|
# @param req [Hash{Symbol=>Object}] .
|
|
236
223
|
#
|
|
237
|
-
#
|
|
224
|
+
# @option req [Symbol] :method
|
|
238
225
|
#
|
|
239
|
-
#
|
|
226
|
+
# @option req [String, Array<String>] :path
|
|
240
227
|
#
|
|
241
|
-
#
|
|
228
|
+
# @option req [Hash{String=>Array<String>, String, nil}, nil] :query
|
|
242
229
|
#
|
|
243
|
-
#
|
|
230
|
+
# @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
|
|
244
231
|
#
|
|
245
|
-
#
|
|
232
|
+
# @option req [Object, nil] :body
|
|
246
233
|
#
|
|
247
|
-
#
|
|
234
|
+
# @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
|
|
248
235
|
#
|
|
249
|
-
#
|
|
236
|
+
# @option req [Class<EInvoiceAPI::Internal::Type::BasePage>, nil] :page
|
|
250
237
|
#
|
|
251
|
-
#
|
|
238
|
+
# @option req [Class<EInvoiceAPI::Internal::Type::BaseStream>, nil] :stream
|
|
252
239
|
#
|
|
253
|
-
#
|
|
240
|
+
# @option req [EInvoiceAPI::Internal::Type::Converter, Class, nil] :model
|
|
254
241
|
#
|
|
255
242
|
# @param opts [Hash{Symbol=>Object}] .
|
|
256
243
|
#
|
|
257
|
-
#
|
|
244
|
+
# @option opts [String, nil] :idempotency_key
|
|
258
245
|
#
|
|
259
|
-
#
|
|
246
|
+
# @option opts [Hash{String=>Array<String>, String, nil}, nil] :extra_query
|
|
260
247
|
#
|
|
261
|
-
#
|
|
248
|
+
# @option opts [Hash{String=>String, nil}, nil] :extra_headers
|
|
262
249
|
#
|
|
263
|
-
#
|
|
250
|
+
# @option opts [Object, nil] :extra_body
|
|
264
251
|
#
|
|
265
|
-
#
|
|
252
|
+
# @option opts [Integer, nil] :max_retries
|
|
266
253
|
#
|
|
267
|
-
#
|
|
254
|
+
# @option opts [Float, nil] :timeout
|
|
268
255
|
#
|
|
269
256
|
# @return [Hash{Symbol=>Object}]
|
|
270
257
|
private def build_request(req, opts)
|
|
@@ -287,14 +274,7 @@ module EInvoiceAPI
|
|
|
287
274
|
headers[@idempotency_header] = opts.fetch(:idempotency_key) { generate_idempotency_key }
|
|
288
275
|
end
|
|
289
276
|
|
|
290
|
-
unless headers.key?("x-stainless-retry-count")
|
|
291
|
-
headers["x-stainless-retry-count"] = "0"
|
|
292
|
-
end
|
|
293
|
-
|
|
294
277
|
timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..)
|
|
295
|
-
unless headers.key?("x-stainless-timeout") || timeout.zero?
|
|
296
|
-
headers["x-stainless-timeout"] = timeout.to_s
|
|
297
|
-
end
|
|
298
278
|
|
|
299
279
|
headers.reject! { |_, v| v.to_s.empty? }
|
|
300
280
|
|
|
@@ -356,34 +336,28 @@ module EInvoiceAPI
|
|
|
356
336
|
#
|
|
357
337
|
# @param request [Hash{Symbol=>Object}] .
|
|
358
338
|
#
|
|
359
|
-
#
|
|
339
|
+
# @option request [Symbol] :method
|
|
360
340
|
#
|
|
361
|
-
#
|
|
341
|
+
# @option request [URI::Generic] :url
|
|
362
342
|
#
|
|
363
|
-
#
|
|
343
|
+
# @option request [Hash{String=>String}] :headers
|
|
364
344
|
#
|
|
365
|
-
#
|
|
345
|
+
# @option request [Object] :body
|
|
366
346
|
#
|
|
367
|
-
#
|
|
347
|
+
# @option request [Integer] :max_retries
|
|
368
348
|
#
|
|
369
|
-
#
|
|
349
|
+
# @option request [Float] :timeout
|
|
370
350
|
#
|
|
371
351
|
# @param redirect_count [Integer]
|
|
372
352
|
#
|
|
373
353
|
# @param retry_count [Integer]
|
|
374
354
|
#
|
|
375
|
-
# @param send_retry_header [Boolean]
|
|
376
|
-
#
|
|
377
355
|
# @raise [EInvoiceAPI::Errors::APIError]
|
|
378
356
|
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
|
|
379
|
-
def send_request(request, redirect_count:, retry_count
|
|
380
|
-
url,
|
|
357
|
+
def send_request(request, redirect_count:, retry_count:)
|
|
358
|
+
url, max_retries, timeout = request.fetch_values(:url, :max_retries, :timeout)
|
|
381
359
|
input = {**request.except(:timeout), deadline: EInvoiceAPI::Internal::Util.monotonic_secs + timeout}
|
|
382
360
|
|
|
383
|
-
if send_retry_header
|
|
384
|
-
headers["x-stainless-retry-count"] = retry_count.to_s
|
|
385
|
-
end
|
|
386
|
-
|
|
387
361
|
begin
|
|
388
362
|
status, response, stream = @requester.execute(input)
|
|
389
363
|
rescue EInvoiceAPI::Errors::APIConnectionError => e
|
|
@@ -406,8 +380,7 @@ module EInvoiceAPI
|
|
|
406
380
|
send_request(
|
|
407
381
|
request,
|
|
408
382
|
redirect_count: redirect_count + 1,
|
|
409
|
-
retry_count: retry_count
|
|
410
|
-
send_retry_header: send_retry_header
|
|
383
|
+
retry_count: retry_count
|
|
411
384
|
)
|
|
412
385
|
in EInvoiceAPI::Errors::APIConnectionError if retry_count >= max_retries
|
|
413
386
|
raise status
|
|
@@ -435,8 +408,7 @@ module EInvoiceAPI
|
|
|
435
408
|
send_request(
|
|
436
409
|
request,
|
|
437
410
|
redirect_count: redirect_count,
|
|
438
|
-
retry_count: retry_count + 1
|
|
439
|
-
send_retry_header: send_retry_header
|
|
411
|
+
retry_count: retry_count + 1
|
|
440
412
|
)
|
|
441
413
|
end
|
|
442
414
|
end
|
|
@@ -446,25 +418,25 @@ module EInvoiceAPI
|
|
|
446
418
|
#
|
|
447
419
|
# @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: EInvoiceAPI::Internal::Type::Unknown, options: {})
|
|
448
420
|
#
|
|
449
|
-
#
|
|
421
|
+
# @param method [Symbol]
|
|
450
422
|
#
|
|
451
|
-
#
|
|
423
|
+
# @param path [String, Array<String>]
|
|
452
424
|
#
|
|
453
|
-
#
|
|
425
|
+
# @param query [Hash{String=>Array<String>, String, nil}, nil]
|
|
454
426
|
#
|
|
455
|
-
#
|
|
427
|
+
# @param headers [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil]
|
|
456
428
|
#
|
|
457
|
-
#
|
|
429
|
+
# @param body [Object, nil]
|
|
458
430
|
#
|
|
459
|
-
#
|
|
431
|
+
# @param unwrap [Symbol, Integer, Array<Symbol, Integer>, Proc, nil]
|
|
460
432
|
#
|
|
461
|
-
#
|
|
433
|
+
# @param page [Class<EInvoiceAPI::Internal::Type::BasePage>, nil]
|
|
462
434
|
#
|
|
463
|
-
#
|
|
435
|
+
# @param stream [Class<EInvoiceAPI::Internal::Type::BaseStream>, nil]
|
|
464
436
|
#
|
|
465
|
-
#
|
|
437
|
+
# @param model [EInvoiceAPI::Internal::Type::Converter, Class, nil]
|
|
466
438
|
#
|
|
467
|
-
#
|
|
439
|
+
# @param options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil] .
|
|
468
440
|
#
|
|
469
441
|
# @option options [String, nil] :idempotency_key
|
|
470
442
|
#
|
|
@@ -489,14 +461,7 @@ module EInvoiceAPI
|
|
|
489
461
|
request = build_request(req.except(:options), opts)
|
|
490
462
|
url = request.fetch(:url)
|
|
491
463
|
|
|
492
|
-
|
|
493
|
-
send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0"
|
|
494
|
-
status, response, stream = send_request(
|
|
495
|
-
request,
|
|
496
|
-
redirect_count: 0,
|
|
497
|
-
retry_count: 0,
|
|
498
|
-
send_retry_header: send_retry_header
|
|
499
|
-
)
|
|
464
|
+
status, response, stream = send_request(request, redirect_count: 0, retry_count: 0)
|
|
500
465
|
|
|
501
466
|
headers = EInvoiceAPI::Internal::Util.normalized_headers(response.each_header.to_h)
|
|
502
467
|
decoded = EInvoiceAPI::Internal::Util.decode_content(headers, stream: stream)
|
|
@@ -52,11 +52,11 @@ module EInvoiceAPI
|
|
|
52
52
|
#
|
|
53
53
|
# @param request [Hash{Symbol=>Object}] .
|
|
54
54
|
#
|
|
55
|
-
#
|
|
55
|
+
# @option request [Symbol] :method
|
|
56
56
|
#
|
|
57
|
-
#
|
|
57
|
+
# @option request [URI::Generic] :url
|
|
58
58
|
#
|
|
59
|
-
#
|
|
59
|
+
# @option request [Hash{String=>String}] :headers
|
|
60
60
|
#
|
|
61
61
|
# @param blk [Proc]
|
|
62
62
|
#
|
|
@@ -116,15 +116,15 @@ module EInvoiceAPI
|
|
|
116
116
|
#
|
|
117
117
|
# @param request [Hash{Symbol=>Object}] .
|
|
118
118
|
#
|
|
119
|
-
#
|
|
119
|
+
# @option request [Symbol] :method
|
|
120
120
|
#
|
|
121
|
-
#
|
|
121
|
+
# @option request [URI::Generic] :url
|
|
122
122
|
#
|
|
123
|
-
#
|
|
123
|
+
# @option request [Hash{String=>String}] :headers
|
|
124
124
|
#
|
|
125
|
-
#
|
|
125
|
+
# @option request [Object] :body
|
|
126
126
|
#
|
|
127
|
-
#
|
|
127
|
+
# @option request [Float] :deadline
|
|
128
128
|
#
|
|
129
129
|
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
|
|
130
130
|
def execute(request)
|
|
@@ -18,9 +18,9 @@ module EInvoiceAPI
|
|
|
18
18
|
|
|
19
19
|
# @overload [](type_info, spec = {})
|
|
20
20
|
#
|
|
21
|
-
#
|
|
21
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, EInvoiceAPI::Internal::Type::Converter, Class]
|
|
22
22
|
#
|
|
23
|
-
#
|
|
23
|
+
# @param spec [Hash{Symbol=>Object}] .
|
|
24
24
|
#
|
|
25
25
|
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
|
26
26
|
#
|
|
@@ -62,15 +62,15 @@ module EInvoiceAPI
|
|
|
62
62
|
#
|
|
63
63
|
# @param state [Hash{Symbol=>Object}] .
|
|
64
64
|
#
|
|
65
|
-
#
|
|
65
|
+
# @option state [Boolean] :translate_names
|
|
66
66
|
#
|
|
67
|
-
#
|
|
67
|
+
# @option state [Boolean] :strictness
|
|
68
68
|
#
|
|
69
|
-
#
|
|
69
|
+
# @option state [Hash{Symbol=>Object}] :exactness
|
|
70
70
|
#
|
|
71
|
-
#
|
|
71
|
+
# @option state [Class<StandardError>] :error
|
|
72
72
|
#
|
|
73
|
-
#
|
|
73
|
+
# @option state [Integer] :branched
|
|
74
74
|
#
|
|
75
75
|
# @return [Array<Object>, Object]
|
|
76
76
|
def coerce(value, state:)
|
|
@@ -102,7 +102,7 @@ module EInvoiceAPI
|
|
|
102
102
|
#
|
|
103
103
|
# @param state [Hash{Symbol=>Object}] .
|
|
104
104
|
#
|
|
105
|
-
#
|
|
105
|
+
# @option state [Boolean] :can_retry
|
|
106
106
|
#
|
|
107
107
|
# @return [Array<Object>, Object]
|
|
108
108
|
def dump(value, state:)
|
|
@@ -139,13 +139,13 @@ module EInvoiceAPI
|
|
|
139
139
|
#
|
|
140
140
|
# @param spec [Hash{Symbol=>Object}] .
|
|
141
141
|
#
|
|
142
|
-
#
|
|
142
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
|
143
143
|
#
|
|
144
|
-
#
|
|
144
|
+
# @option spec [Proc] :enum
|
|
145
145
|
#
|
|
146
|
-
#
|
|
146
|
+
# @option spec [Proc] :union
|
|
147
147
|
#
|
|
148
|
-
#
|
|
148
|
+
# @option spec [Boolean] :"nil?"
|
|
149
149
|
def initialize(type_info, spec = {})
|
|
150
150
|
@item_type_fn = EInvoiceAPI::Internal::Type::Converter.type_info(type_info || spec)
|
|
151
151
|
@meta = EInvoiceAPI::Internal::Type::Converter.meta_info(type_info, spec)
|