e-invoice-api 0.1.0.pre.alpha.5

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.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +57 -0
  4. data/README.md +285 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/e_invoice_api/client.rb +94 -0
  7. data/lib/e_invoice_api/errors.rb +192 -0
  8. data/lib/e_invoice_api/file_part.rb +55 -0
  9. data/lib/e_invoice_api/internal/documents_number_page.rb +96 -0
  10. data/lib/e_invoice_api/internal/transport/base_client.rb +555 -0
  11. data/lib/e_invoice_api/internal/transport/pooled_net_requester.rb +209 -0
  12. data/lib/e_invoice_api/internal/type/array_of.rb +162 -0
  13. data/lib/e_invoice_api/internal/type/base_model.rb +482 -0
  14. data/lib/e_invoice_api/internal/type/base_page.rb +55 -0
  15. data/lib/e_invoice_api/internal/type/boolean.rb +71 -0
  16. data/lib/e_invoice_api/internal/type/converter.rb +292 -0
  17. data/lib/e_invoice_api/internal/type/enum.rb +148 -0
  18. data/lib/e_invoice_api/internal/type/file_input.rb +103 -0
  19. data/lib/e_invoice_api/internal/type/hash_of.rb +182 -0
  20. data/lib/e_invoice_api/internal/type/request_parameters.rb +42 -0
  21. data/lib/e_invoice_api/internal/type/union.rb +236 -0
  22. data/lib/e_invoice_api/internal/type/unknown.rb +75 -0
  23. data/lib/e_invoice_api/internal/util.rb +914 -0
  24. data/lib/e_invoice_api/internal.rb +20 -0
  25. data/lib/e_invoice_api/models/certificate.rb +34 -0
  26. data/lib/e_invoice_api/models/currency_code.rb +28 -0
  27. data/lib/e_invoice_api/models/document_attachment_create.rb +33 -0
  28. data/lib/e_invoice_api/models/document_create.rb +521 -0
  29. data/lib/e_invoice_api/models/document_create_params.rb +14 -0
  30. data/lib/e_invoice_api/models/document_delete_params.rb +14 -0
  31. data/lib/e_invoice_api/models/document_delete_response.rb +16 -0
  32. data/lib/e_invoice_api/models/document_direction.rb +15 -0
  33. data/lib/e_invoice_api/models/document_response.rb +418 -0
  34. data/lib/e_invoice_api/models/document_retrieve_params.rb +14 -0
  35. data/lib/e_invoice_api/models/document_send_params.rb +44 -0
  36. data/lib/e_invoice_api/models/document_state.rb +18 -0
  37. data/lib/e_invoice_api/models/document_type.rb +15 -0
  38. data/lib/e_invoice_api/models/documents/attachment_add_params.rb +22 -0
  39. data/lib/e_invoice_api/models/documents/attachment_delete_params.rb +22 -0
  40. data/lib/e_invoice_api/models/documents/attachment_delete_response.rb +18 -0
  41. data/lib/e_invoice_api/models/documents/attachment_list_params.rb +16 -0
  42. data/lib/e_invoice_api/models/documents/attachment_list_response.rb +11 -0
  43. data/lib/e_invoice_api/models/documents/attachment_retrieve_params.rb +22 -0
  44. data/lib/e_invoice_api/models/documents/document_attachment.rb +44 -0
  45. data/lib/e_invoice_api/models/documents/ubl_get_params.rb +16 -0
  46. data/lib/e_invoice_api/models/documents/ubl_get_response.rb +72 -0
  47. data/lib/e_invoice_api/models/inbox_list_credit_notes_params.rb +30 -0
  48. data/lib/e_invoice_api/models/inbox_list_invoices_params.rb +30 -0
  49. data/lib/e_invoice_api/models/inbox_list_params.rb +78 -0
  50. data/lib/e_invoice_api/models/lookup_retrieve_params.rb +26 -0
  51. data/lib/e_invoice_api/models/lookup_retrieve_response.rb +491 -0
  52. data/lib/e_invoice_api/models/outbox_list_draft_documents_params.rb +30 -0
  53. data/lib/e_invoice_api/models/outbox_list_received_documents_params.rb +78 -0
  54. data/lib/e_invoice_api/models/paginated_document_response.rb +39 -0
  55. data/lib/e_invoice_api/models/payment_detail_create.rb +33 -0
  56. data/lib/e_invoice_api/models/ubl_document_validation.rb +97 -0
  57. data/lib/e_invoice_api/models/unit_of_measure_code.rb +104 -0
  58. data/lib/e_invoice_api/models/validate_validate_json_params.rb +14 -0
  59. data/lib/e_invoice_api/models/validate_validate_peppol_id_params.rb +26 -0
  60. data/lib/e_invoice_api/models/validate_validate_peppol_id_response.rb +80 -0
  61. data/lib/e_invoice_api/models/validate_validate_ubl_params.rb +20 -0
  62. data/lib/e_invoice_api/models/webhook_create_params.rb +32 -0
  63. data/lib/e_invoice_api/models/webhook_delete_params.rb +14 -0
  64. data/lib/e_invoice_api/models/webhook_delete_response.rb +18 -0
  65. data/lib/e_invoice_api/models/webhook_list_params.rb +14 -0
  66. data/lib/e_invoice_api/models/webhook_list_response.rb +8 -0
  67. data/lib/e_invoice_api/models/webhook_response.rb +42 -0
  68. data/lib/e_invoice_api/models/webhook_retrieve_params.rb +14 -0
  69. data/lib/e_invoice_api/models/webhook_update_params.rb +32 -0
  70. data/lib/e_invoice_api/models.rb +105 -0
  71. data/lib/e_invoice_api/request_options.rb +77 -0
  72. data/lib/e_invoice_api/resources/documents/attachments.rb +109 -0
  73. data/lib/e_invoice_api/resources/documents/ubl.rb +35 -0
  74. data/lib/e_invoice_api/resources/documents.rb +188 -0
  75. data/lib/e_invoice_api/resources/inbox.rb +101 -0
  76. data/lib/e_invoice_api/resources/lookup.rb +43 -0
  77. data/lib/e_invoice_api/resources/outbox.rb +76 -0
  78. data/lib/e_invoice_api/resources/validate.rb +168 -0
  79. data/lib/e_invoice_api/resources/webhooks.rb +117 -0
  80. data/lib/e_invoice_api/version.rb +5 -0
  81. data/lib/e_invoice_api.rb +107 -0
  82. data/manifest.yaml +15 -0
  83. data/rbi/e_invoice_api/client.rbi +64 -0
  84. data/rbi/e_invoice_api/errors.rbi +162 -0
  85. data/rbi/e_invoice_api/file_part.rbi +37 -0
  86. data/rbi/e_invoice_api/internal/documents_number_page.rbi +28 -0
  87. data/rbi/e_invoice_api/internal/transport/base_client.rbi +298 -0
  88. data/rbi/e_invoice_api/internal/transport/pooled_net_requester.rbi +80 -0
  89. data/rbi/e_invoice_api/internal/type/array_of.rbi +104 -0
  90. data/rbi/e_invoice_api/internal/type/base_model.rbi +304 -0
  91. data/rbi/e_invoice_api/internal/type/base_page.rbi +43 -0
  92. data/rbi/e_invoice_api/internal/type/boolean.rbi +56 -0
  93. data/rbi/e_invoice_api/internal/type/converter.rbi +162 -0
  94. data/rbi/e_invoice_api/internal/type/enum.rbi +82 -0
  95. data/rbi/e_invoice_api/internal/type/file_input.rbi +59 -0
  96. data/rbi/e_invoice_api/internal/type/hash_of.rbi +104 -0
  97. data/rbi/e_invoice_api/internal/type/request_parameters.rbi +31 -0
  98. data/rbi/e_invoice_api/internal/type/union.rbi +116 -0
  99. data/rbi/e_invoice_api/internal/type/unknown.rbi +56 -0
  100. data/rbi/e_invoice_api/internal/util.rbi +487 -0
  101. data/rbi/e_invoice_api/internal.rbi +18 -0
  102. data/rbi/e_invoice_api/models/certificate.rbi +54 -0
  103. data/rbi/e_invoice_api/models/currency_code.rbi +34 -0
  104. data/rbi/e_invoice_api/models/document_attachment_create.rbi +57 -0
  105. data/rbi/e_invoice_api/models/document_create.rbi +638 -0
  106. data/rbi/e_invoice_api/models/document_create_params.rbi +30 -0
  107. data/rbi/e_invoice_api/models/document_delete_params.rbi +30 -0
  108. data/rbi/e_invoice_api/models/document_delete_response.rbi +26 -0
  109. data/rbi/e_invoice_api/models/document_direction.rbi +22 -0
  110. data/rbi/e_invoice_api/models/document_response.rbi +504 -0
  111. data/rbi/e_invoice_api/models/document_retrieve_params.rbi +30 -0
  112. data/rbi/e_invoice_api/models/document_send_params.rbi +65 -0
  113. data/rbi/e_invoice_api/models/document_state.rbi +24 -0
  114. data/rbi/e_invoice_api/models/document_type.rbi +21 -0
  115. data/rbi/e_invoice_api/models/documents/attachment_add_params.rbi +43 -0
  116. data/rbi/e_invoice_api/models/documents/attachment_delete_params.rbi +43 -0
  117. data/rbi/e_invoice_api/models/documents/attachment_delete_response.rbi +28 -0
  118. data/rbi/e_invoice_api/models/documents/attachment_list_params.rbi +34 -0
  119. data/rbi/e_invoice_api/models/documents/attachment_list_response.rbi +15 -0
  120. data/rbi/e_invoice_api/models/documents/attachment_retrieve_params.rbi +43 -0
  121. data/rbi/e_invoice_api/models/documents/document_attachment.rbi +72 -0
  122. data/rbi/e_invoice_api/models/documents/ubl_get_params.rbi +34 -0
  123. data/rbi/e_invoice_api/models/documents/ubl_get_response.rbi +97 -0
  124. data/rbi/e_invoice_api/models/inbox_list_credit_notes_params.rbi +60 -0
  125. data/rbi/e_invoice_api/models/inbox_list_invoices_params.rbi +60 -0
  126. data/rbi/e_invoice_api/models/inbox_list_params.rbi +105 -0
  127. data/rbi/e_invoice_api/models/lookup_retrieve_params.rbi +45 -0
  128. data/rbi/e_invoice_api/models/lookup_retrieve_response.rbi +852 -0
  129. data/rbi/e_invoice_api/models/outbox_list_draft_documents_params.rbi +60 -0
  130. data/rbi/e_invoice_api/models/outbox_list_received_documents_params.rbi +108 -0
  131. data/rbi/e_invoice_api/models/paginated_document_response.rbi +56 -0
  132. data/rbi/e_invoice_api/models/payment_detail_create.rbi +56 -0
  133. data/rbi/e_invoice_api/models/ubl_document_validation.rbi +159 -0
  134. data/rbi/e_invoice_api/models/unit_of_measure_code.rbi +149 -0
  135. data/rbi/e_invoice_api/models/validate_validate_json_params.rbi +30 -0
  136. data/rbi/e_invoice_api/models/validate_validate_peppol_id_params.rbi +45 -0
  137. data/rbi/e_invoice_api/models/validate_validate_peppol_id_response.rbi +141 -0
  138. data/rbi/e_invoice_api/models/validate_validate_ubl_params.rbi +41 -0
  139. data/rbi/e_invoice_api/models/webhook_create_params.rbi +54 -0
  140. data/rbi/e_invoice_api/models/webhook_delete_params.rbi +30 -0
  141. data/rbi/e_invoice_api/models/webhook_delete_response.rbi +27 -0
  142. data/rbi/e_invoice_api/models/webhook_list_params.rbi +27 -0
  143. data/rbi/e_invoice_api/models/webhook_list_response.rbi +11 -0
  144. data/rbi/e_invoice_api/models/webhook_response.rbi +57 -0
  145. data/rbi/e_invoice_api/models/webhook_retrieve_params.rbi +30 -0
  146. data/rbi/e_invoice_api/models/webhook_update_params.rbi +51 -0
  147. data/rbi/e_invoice_api/models.rbi +70 -0
  148. data/rbi/e_invoice_api/request_options.rbi +59 -0
  149. data/rbi/e_invoice_api/resources/documents/attachments.rbi +58 -0
  150. data/rbi/e_invoice_api/resources/documents/ubl.rbi +24 -0
  151. data/rbi/e_invoice_api/resources/documents.rbi +164 -0
  152. data/rbi/e_invoice_api/resources/inbox.rbi +93 -0
  153. data/rbi/e_invoice_api/resources/lookup.rbi +31 -0
  154. data/rbi/e_invoice_api/resources/outbox.rbi +72 -0
  155. data/rbi/e_invoice_api/resources/validate.rbi +145 -0
  156. data/rbi/e_invoice_api/resources/webhooks.rbi +72 -0
  157. data/rbi/e_invoice_api/version.rbi +5 -0
  158. data/sig/e_invoice_api/client.rbs +36 -0
  159. data/sig/e_invoice_api/errors.rbs +101 -0
  160. data/sig/e_invoice_api/file_part.rbs +21 -0
  161. data/sig/e_invoice_api/internal/documents_number_page.rbs +17 -0
  162. data/sig/e_invoice_api/internal/transport/base_client.rbs +131 -0
  163. data/sig/e_invoice_api/internal/transport/pooled_net_requester.rbs +45 -0
  164. data/sig/e_invoice_api/internal/type/array_of.rbs +48 -0
  165. data/sig/e_invoice_api/internal/type/base_model.rbs +102 -0
  166. data/sig/e_invoice_api/internal/type/base_page.rbs +24 -0
  167. data/sig/e_invoice_api/internal/type/boolean.rbs +26 -0
  168. data/sig/e_invoice_api/internal/type/converter.rbs +56 -0
  169. data/sig/e_invoice_api/internal/type/enum.rbs +32 -0
  170. data/sig/e_invoice_api/internal/type/file_input.rbs +25 -0
  171. data/sig/e_invoice_api/internal/type/hash_of.rbs +48 -0
  172. data/sig/e_invoice_api/internal/type/request_parameters.rbs +19 -0
  173. data/sig/e_invoice_api/internal/type/union.rbs +52 -0
  174. data/sig/e_invoice_api/internal/type/unknown.rbs +26 -0
  175. data/sig/e_invoice_api/internal/util.rbs +185 -0
  176. data/sig/e_invoice_api/internal.rbs +9 -0
  177. data/sig/e_invoice_api/models/certificate.rbs +26 -0
  178. data/sig/e_invoice_api/models/currency_code.rbs +42 -0
  179. data/sig/e_invoice_api/models/document_attachment_create.rbs +39 -0
  180. data/sig/e_invoice_api/models/document_create.rbs +403 -0
  181. data/sig/e_invoice_api/models/document_create_params.rbs +15 -0
  182. data/sig/e_invoice_api/models/document_delete_params.rbs +15 -0
  183. data/sig/e_invoice_api/models/document_delete_response.rbs +13 -0
  184. data/sig/e_invoice_api/models/document_direction.rbs +14 -0
  185. data/sig/e_invoice_api/models/document_response.rbs +358 -0
  186. data/sig/e_invoice_api/models/document_retrieve_params.rbs +15 -0
  187. data/sig/e_invoice_api/models/document_send_params.rbs +46 -0
  188. data/sig/e_invoice_api/models/document_state.rbs +17 -0
  189. data/sig/e_invoice_api/models/document_type.rbs +14 -0
  190. data/sig/e_invoice_api/models/documents/attachment_add_params.rbs +26 -0
  191. data/sig/e_invoice_api/models/documents/attachment_delete_params.rbs +26 -0
  192. data/sig/e_invoice_api/models/documents/attachment_delete_response.rbs +15 -0
  193. data/sig/e_invoice_api/models/documents/attachment_list_params.rbs +17 -0
  194. data/sig/e_invoice_api/models/documents/attachment_list_response.rbs +10 -0
  195. data/sig/e_invoice_api/models/documents/attachment_retrieve_params.rbs +26 -0
  196. data/sig/e_invoice_api/models/documents/document_attachment.rbs +48 -0
  197. data/sig/e_invoice_api/models/documents/ubl_get_params.rbs +17 -0
  198. data/sig/e_invoice_api/models/documents/ubl_get_response.rbs +69 -0
  199. data/sig/e_invoice_api/models/inbox_list_credit_notes_params.rbs +32 -0
  200. data/sig/e_invoice_api/models/inbox_list_invoices_params.rbs +32 -0
  201. data/sig/e_invoice_api/models/inbox_list_params.rbs +65 -0
  202. data/sig/e_invoice_api/models/lookup_retrieve_params.rbs +23 -0
  203. data/sig/e_invoice_api/models/lookup_retrieve_response.rbs +365 -0
  204. data/sig/e_invoice_api/models/outbox_list_draft_documents_params.rbs +32 -0
  205. data/sig/e_invoice_api/models/outbox_list_received_documents_params.rbs +65 -0
  206. data/sig/e_invoice_api/models/paginated_document_response.rbs +40 -0
  207. data/sig/e_invoice_api/models/payment_detail_create.rbs +35 -0
  208. data/sig/e_invoice_api/models/ubl_document_validation.rbs +98 -0
  209. data/sig/e_invoice_api/models/unit_of_measure_code.rbs +192 -0
  210. data/sig/e_invoice_api/models/validate_validate_json_params.rbs +15 -0
  211. data/sig/e_invoice_api/models/validate_validate_peppol_id_params.rbs +23 -0
  212. data/sig/e_invoice_api/models/validate_validate_peppol_id_response.rbs +65 -0
  213. data/sig/e_invoice_api/models/validate_validate_ubl_params.rbs +24 -0
  214. data/sig/e_invoice_api/models/webhook_create_params.rbs +34 -0
  215. data/sig/e_invoice_api/models/webhook_delete_params.rbs +15 -0
  216. data/sig/e_invoice_api/models/webhook_delete_response.rbs +13 -0
  217. data/sig/e_invoice_api/models/webhook_list_params.rbs +15 -0
  218. data/sig/e_invoice_api/models/webhook_list_response.rbs +7 -0
  219. data/sig/e_invoice_api/models/webhook_response.rbs +42 -0
  220. data/sig/e_invoice_api/models/webhook_retrieve_params.rbs +15 -0
  221. data/sig/e_invoice_api/models/webhook_update_params.rbs +32 -0
  222. data/sig/e_invoice_api/models.rbs +65 -0
  223. data/sig/e_invoice_api/request_options.rbs +36 -0
  224. data/sig/e_invoice_api/resources/documents/attachments.rbs +32 -0
  225. data/sig/e_invoice_api/resources/documents/ubl.rbs +14 -0
  226. data/sig/e_invoice_api/resources/documents.rbs +76 -0
  227. data/sig/e_invoice_api/resources/inbox.rbs +31 -0
  228. data/sig/e_invoice_api/resources/lookup.rbs +12 -0
  229. data/sig/e_invoice_api/resources/outbox.rbs +25 -0
  230. data/sig/e_invoice_api/resources/validate.rbs +62 -0
  231. data/sig/e_invoice_api/resources/webhooks.rbs +36 -0
  232. data/sig/e_invoice_api/version.rbs +3 -0
  233. metadata +290 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 442bea54ce502931e88fe322f63412115cdc8cbd69b523d06ff60c1f68589e41
4
+ data.tar.gz: d835eab08bd5e1d8aeb233d32c44f682c6b0459c00b6f5205525da28810ed319
5
+ SHA512:
6
+ metadata.gz: babc76b3861ef91d079be95e64358ad5337e239cbe9e7177d75b70cd0ba7e354e1aa470fd226432fcb2e1fbe4b4d30776e1946673cae4d8366c606b10a0a7e90
7
+ data.tar.gz: 95a2f5df2995834b95651843d75012e81657ab69d10caa3a809d22782e84054ec96b2a2f1d2f37b593be8aeb789c27f40b07c028c55a4cd69321d16ccce4ce99
data/.ignore ADDED
@@ -0,0 +1,2 @@
1
+ rbi/*
2
+ sig/*
data/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0-alpha.5 (2025-06-17)
4
+
5
+ Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
6
+
7
+ ### Bug Fixes
8
+
9
+ * feat(api): manual updates ([fa6a501](https://github.com/e-invoice-be/e-invoice-rb/commit/fa6a501d6552c90798a3b8a4523d020e7f8ffc23))
10
+
11
+
12
+ ### Chores
13
+
14
+ * **internal:** version bump ([f9d9dd9](https://github.com/e-invoice-be/e-invoice-rb/commit/f9d9dd9f56b088ba2181e9abd4ad009a3d53eff9))
15
+
16
+ ## 0.1.0-alpha.4 (2025-06-17)
17
+
18
+ Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
19
+
20
+ ### Chores
21
+
22
+ * **internal:** version bump ([6e89b42](https://github.com/e-invoice-be/e-invoice-rb/commit/6e89b4255d882486ca49aaaa175948d253c4e551))
23
+
24
+ ## 0.1.0-alpha.3 (2025-06-17)
25
+
26
+ Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
27
+
28
+ ### Chores
29
+
30
+ * **internal:** version bump ([e058e23](https://github.com/e-invoice-be/e-invoice-rb/commit/e058e233d27cf29446c458a3abe3885e6ebedd6c))
31
+
32
+
33
+ ### Documentation
34
+
35
+ * Update README.md ([f2ab975](https://github.com/e-invoice-be/e-invoice-rb/commit/f2ab975d57c9556626f481766759173f9362a34d))
36
+
37
+ ## 0.1.0-alpha.2 (2025-06-17)
38
+
39
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
40
+
41
+ ### Features
42
+
43
+ * **api:** manual updates ([855202f](https://github.com/e-invoice-be/e-invoice-rb/commit/855202f9724b6f846d24b36508863e22b72d215f))
44
+
45
+ ## 0.1.0-alpha.1 (2025-06-17)
46
+
47
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/e-invoice-be/e-invoice-rb/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
48
+
49
+ ### Features
50
+
51
+ * **api:** manual updates ([9052941](https://github.com/e-invoice-be/e-invoice-rb/commit/9052941355822aac188a540fd9f77fd05556d143))
52
+
53
+
54
+ ### Chores
55
+
56
+ * configure new SDK language ([3a0decc](https://github.com/e-invoice-be/e-invoice-rb/commit/3a0deccb4ae72d7e212264c4db4e1cc60582ae21))
57
+ * update SDK settings ([3a8c815](https://github.com/e-invoice-be/e-invoice-rb/commit/3a8c8157b713da215c8b0853ad78f726d3b81ba4))
data/README.md ADDED
@@ -0,0 +1,285 @@
1
+ # e-invoice.be Peppol API library
2
+
3
+ The e-invoice.be Peppol library provides convenient access to the E Invoice REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/e-invoice-be/e-invoice-rb#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
+
5
+ To get an API key, [make a free account](https://app.e-invoice.be/register?ref=ruby) and register your company.
6
+
7
+ ## Documentation
8
+
9
+ Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/e-invoice-api).
10
+
11
+ The full REST API documentation can be found on [api.e-invoice.be](https://api.e-invoice.be/api/redoc).
12
+
13
+ ## Installation
14
+
15
+ To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
16
+
17
+ <!-- x-release-please-start-version -->
18
+
19
+ ```ruby
20
+ gem "e-invoice-api", "~> 0.1.0.pre.alpha.5"
21
+ ```
22
+
23
+ <!-- x-release-please-end -->
24
+
25
+ ## Usage
26
+
27
+ ```ruby
28
+ require "bundler/setup"
29
+ require "e_invoice_api"
30
+
31
+ e_invoice = EInvoiceAPI::Client.new(
32
+ api_key: ENV["E_INVOICE_API_KEY"] # This is the default and can be omitted
33
+ )
34
+
35
+ document_response = e_invoice.documents.create
36
+
37
+ puts(document_response.id)
38
+ ```
39
+
40
+ ### Pagination
41
+
42
+ List methods in the E Invoice API are paginated.
43
+
44
+ This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
45
+
46
+ ```ruby
47
+ page = e_invoice.inbox.list
48
+
49
+ # Fetch single item from page.
50
+ inbox = page.items[0]
51
+ puts(inbox.id)
52
+
53
+ # Automatically fetches more pages as needed.
54
+ page.auto_paging_each do |inbox|
55
+ puts(inbox.id)
56
+ end
57
+ ```
58
+
59
+ Alternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.
60
+
61
+ ```ruby
62
+ if page.next_page?
63
+ new_page = page.next_page
64
+ puts(new_page.items[0].id)
65
+ end
66
+ ```
67
+
68
+ ### File uploads
69
+
70
+ Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.
71
+
72
+ ```ruby
73
+ require "pathname"
74
+
75
+ # Use `Pathname` to send the filename and/or avoid paging a large file into memory:
76
+ document_attachment = e_invoice.documents.attachments.add(file: Pathname("/path/to/file"))
77
+
78
+ # Alternatively, pass file contents or a `StringIO` directly:
79
+ document_attachment = e_invoice.documents.attachments.add(file: File.read("/path/to/file"))
80
+
81
+ # Or, to control the filename and/or content type:
82
+ file =
83
+ EInvoiceAPI::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")
84
+ document_attachment = e_invoice.documents.attachments.add(file: file)
85
+
86
+ puts(document_attachment.id)
87
+ ```
88
+
89
+ Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't be sure if the descriptor is a file or pipe (which cannot be rewound).
90
+
91
+ ### Handling errors
92
+
93
+ When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `EInvoiceAPI::Errors::APIError` will be thrown:
94
+
95
+ ```ruby
96
+ begin
97
+ document = e_invoice.documents.create
98
+ rescue EInvoiceAPI::Errors::APIConnectionError => e
99
+ puts("The server could not be reached")
100
+ puts(e.cause) # an underlying Exception, likely raised within `net/http`
101
+ rescue EInvoiceAPI::Errors::RateLimitError => e
102
+ puts("A 429 status code was received; we should back off a bit.")
103
+ rescue EInvoiceAPI::Errors::APIStatusError => e
104
+ puts("Another non-200-range status code was received")
105
+ puts(e.status)
106
+ end
107
+ ```
108
+
109
+ Error codes are as follows:
110
+
111
+ | Cause | Error Type |
112
+ | ---------------- | -------------------------- |
113
+ | HTTP 400 | `BadRequestError` |
114
+ | HTTP 401 | `AuthenticationError` |
115
+ | HTTP 403 | `PermissionDeniedError` |
116
+ | HTTP 404 | `NotFoundError` |
117
+ | HTTP 409 | `ConflictError` |
118
+ | HTTP 422 | `UnprocessableEntityError` |
119
+ | HTTP 429 | `RateLimitError` |
120
+ | HTTP >= 500 | `InternalServerError` |
121
+ | Other HTTP error | `APIStatusError` |
122
+ | Timeout | `APITimeoutError` |
123
+ | Network error | `APIConnectionError` |
124
+
125
+ ### Retries
126
+
127
+ Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
128
+
129
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
130
+
131
+ You can use the `max_retries` option to configure or disable this:
132
+
133
+ ```ruby
134
+ # Configure the default for all requests:
135
+ e_invoice = EInvoiceAPI::Client.new(
136
+ max_retries: 0 # default is 2
137
+ )
138
+
139
+ # Or, configure per-request:
140
+ e_invoice.documents.create(request_options: {max_retries: 5})
141
+ ```
142
+
143
+ ### Timeouts
144
+
145
+ By default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:
146
+
147
+ ```ruby
148
+ # Configure the default for all requests:
149
+ e_invoice = EInvoiceAPI::Client.new(
150
+ timeout: nil # default is 60
151
+ )
152
+
153
+ # Or, configure per-request:
154
+ e_invoice.documents.create(request_options: {timeout: 5})
155
+ ```
156
+
157
+ On timeout, `EInvoiceAPI::Errors::APITimeoutError` is raised.
158
+
159
+ Note that requests that time out are retried by default.
160
+
161
+ ## Advanced concepts
162
+
163
+ ### BaseModel
164
+
165
+ All parameter and response objects inherit from `EInvoiceAPI::Internal::Type::BaseModel`, which provides several conveniences, including:
166
+
167
+ 1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.
168
+
169
+ 2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
170
+
171
+ 3. Both instances and the classes themselves can be pretty-printed.
172
+
173
+ 4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
174
+
175
+ ### Making custom or undocumented requests
176
+
177
+ #### Undocumented properties
178
+
179
+ You can send undocumented parameters to any endpoint, and read undocumented response properties, like so:
180
+
181
+ Note: the `extra_` parameters of the same name overrides the documented parameters.
182
+
183
+ ```ruby
184
+ document_response =
185
+ e_invoice.documents.create(
186
+ request_options: {
187
+ extra_query: {my_query_parameter: value},
188
+ extra_body: {my_body_parameter: value},
189
+ extra_headers: {"my-header": value}
190
+ }
191
+ )
192
+
193
+ puts(document_response[:my_undocumented_property])
194
+ ```
195
+
196
+ #### Undocumented request params
197
+
198
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.
199
+
200
+ #### Undocumented endpoints
201
+
202
+ To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:
203
+
204
+ ```ruby
205
+ response = client.request(
206
+ method: :post,
207
+ path: '/undocumented/endpoint',
208
+ query: {"dog": "woof"},
209
+ headers: {"useful-header": "interesting-value"},
210
+ body: {"hello": "world"}
211
+ )
212
+ ```
213
+
214
+ ### Concurrency & connection pooling
215
+
216
+ The `EInvoiceAPI::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.
217
+
218
+ Each instance of `EInvoiceAPI::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.
219
+
220
+ When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.
221
+
222
+ Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.
223
+
224
+ ## Sorbet
225
+
226
+ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.
227
+
228
+ You can provide typesafe request parameters like so:
229
+
230
+ ```ruby
231
+ e_invoice.documents.create
232
+ ```
233
+
234
+ Or, equivalently:
235
+
236
+ ```ruby
237
+ # Hashes work, but are not typesafe:
238
+ e_invoice.documents.create
239
+
240
+ # You can also splat a full Params class:
241
+ params = EInvoiceAPI::DocumentCreateParams.new
242
+ e_invoice.documents.create(**params)
243
+ ```
244
+
245
+ ### Enums
246
+
247
+ Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
248
+
249
+ ```ruby
250
+ # :EUR
251
+ puts(EInvoiceAPI::CurrencyCode::EUR)
252
+
253
+ # Revealed type: `T.all(EInvoiceAPI::CurrencyCode, Symbol)`
254
+ T.reveal_type(EInvoiceAPI::CurrencyCode::EUR)
255
+ ```
256
+
257
+ Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
258
+
259
+ ```ruby
260
+ # Using the enum constants preserves the tagged type information:
261
+ e_invoice.documents.create(
262
+ currency: EInvoiceAPI::CurrencyCode::EUR,
263
+ # …
264
+ )
265
+
266
+ # Literal values are also permissible:
267
+ e_invoice.documents.create(
268
+ currency: :EUR,
269
+ # …
270
+ )
271
+ ```
272
+
273
+ ## Versioning
274
+
275
+ This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
276
+
277
+ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
278
+
279
+ ## Requirements
280
+
281
+ Ruby 3.2.0 or higher.
282
+
283
+ ## Contributing
284
+
285
+ See [the contributing documentation](https://github.com/e-invoice-be/e-invoice-rb/tree/main/CONTRIBUTING.md).
data/SECURITY.md ADDED
@@ -0,0 +1,27 @@
1
+ # Security Policy
2
+
3
+ ## Reporting Security Issues
4
+
5
+ This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
6
+
7
+ To report a security issue, please contact the Stainless team at security@stainless.com.
8
+
9
+ ## Responsible Disclosure
10
+
11
+ We appreciate the efforts of security researchers and individuals who help us maintain the security of
12
+ SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
13
+ disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
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.
24
+
25
+ ---
26
+
27
+ Thank you for helping us keep the SDKs and systems they interact with secure.
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ class Client < EInvoiceAPI::Internal::Transport::BaseClient
5
+ # Default max number of retries to attempt after a failed retryable request.
6
+ DEFAULT_MAX_RETRIES = 2
7
+
8
+ # Default per-request timeout.
9
+ DEFAULT_TIMEOUT_IN_SECONDS = 60.0
10
+
11
+ # Default initial retry delay in seconds.
12
+ # Overall delay is calculated using exponential backoff + jitter.
13
+ DEFAULT_INITIAL_RETRY_DELAY = 0.5
14
+
15
+ # Default max retry delay in seconds.
16
+ DEFAULT_MAX_RETRY_DELAY = 8.0
17
+
18
+ # @return [String]
19
+ attr_reader :api_key
20
+
21
+ # @return [EInvoiceAPI::Resources::Documents]
22
+ attr_reader :documents
23
+
24
+ # @return [EInvoiceAPI::Resources::Inbox]
25
+ attr_reader :inbox
26
+
27
+ # @return [EInvoiceAPI::Resources::Outbox]
28
+ attr_reader :outbox
29
+
30
+ # @return [EInvoiceAPI::Resources::Validate]
31
+ attr_reader :validate
32
+
33
+ # @return [EInvoiceAPI::Resources::Lookup]
34
+ attr_reader :lookup
35
+
36
+ # @return [EInvoiceAPI::Resources::Webhooks]
37
+ attr_reader :webhooks
38
+
39
+ # @api private
40
+ #
41
+ # @return [Hash{String=>String}]
42
+ private def auth_headers
43
+ return {} if @api_key.nil?
44
+
45
+ {"authorization" => "Bearer #{@api_key}"}
46
+ end
47
+
48
+ # Creates and returns a new client for interacting with the API.
49
+ #
50
+ # @param api_key [String, nil] Defaults to `ENV["E_INVOICE_API_KEY"]`
51
+ #
52
+ # @param base_url [String, nil] Override the default base URL for the API, e.g.,
53
+ # `"https://api.example.com/v2/"`. Defaults to `ENV["E_INVOICE_BASE_URL"]`
54
+ #
55
+ # @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
56
+ #
57
+ # @param timeout [Float]
58
+ #
59
+ # @param initial_retry_delay [Float]
60
+ #
61
+ # @param max_retry_delay [Float]
62
+ def initialize(
63
+ api_key: ENV["E_INVOICE_API_KEY"],
64
+ base_url: ENV["E_INVOICE_BASE_URL"],
65
+ max_retries: self.class::DEFAULT_MAX_RETRIES,
66
+ timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
67
+ initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
68
+ max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
69
+ )
70
+ base_url ||= "https://api.e-invoice.be"
71
+
72
+ if api_key.nil?
73
+ raise ArgumentError.new("api_key is required, and can be set via environ: \"E_INVOICE_API_KEY\"")
74
+ end
75
+
76
+ @api_key = api_key.to_s
77
+
78
+ super(
79
+ base_url: base_url,
80
+ timeout: timeout,
81
+ max_retries: max_retries,
82
+ initial_retry_delay: initial_retry_delay,
83
+ max_retry_delay: max_retry_delay
84
+ )
85
+
86
+ @documents = EInvoiceAPI::Resources::Documents.new(client: self)
87
+ @inbox = EInvoiceAPI::Resources::Inbox.new(client: self)
88
+ @outbox = EInvoiceAPI::Resources::Outbox.new(client: self)
89
+ @validate = EInvoiceAPI::Resources::Validate.new(client: self)
90
+ @lookup = EInvoiceAPI::Resources::Lookup.new(client: self)
91
+ @webhooks = EInvoiceAPI::Resources::Webhooks.new(client: self)
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Errors
5
+ class Error < StandardError
6
+ # @!attribute cause
7
+ #
8
+ # @return [StandardError, nil]
9
+ end
10
+
11
+ class ConversionError < EInvoiceAPI::Errors::Error
12
+ end
13
+
14
+ class APIError < EInvoiceAPI::Errors::Error
15
+ # @return [URI::Generic]
16
+ attr_accessor :url
17
+
18
+ # @return [Integer, nil]
19
+ attr_accessor :status
20
+
21
+ # @return [Object, nil]
22
+ attr_accessor :body
23
+
24
+ # @api private
25
+ #
26
+ # @param url [URI::Generic]
27
+ # @param status [Integer, nil]
28
+ # @param body [Object, nil]
29
+ # @param request [nil]
30
+ # @param response [nil]
31
+ # @param message [String, nil]
32
+ def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
33
+ @url = url
34
+ @status = status
35
+ @body = body
36
+ @request = request
37
+ @response = response
38
+ super(message)
39
+ end
40
+ end
41
+
42
+ class APIConnectionError < EInvoiceAPI::Errors::APIError
43
+ # @!attribute status
44
+ #
45
+ # @return [nil]
46
+
47
+ # @!attribute body
48
+ #
49
+ # @return [nil]
50
+
51
+ # @api private
52
+ #
53
+ # @param url [URI::Generic]
54
+ # @param status [nil]
55
+ # @param body [nil]
56
+ # @param request [nil]
57
+ # @param response [nil]
58
+ # @param message [String, nil]
59
+ def initialize(
60
+ url:,
61
+ status: nil,
62
+ body: nil,
63
+ request: nil,
64
+ response: nil,
65
+ message: "Connection error."
66
+ )
67
+ super
68
+ end
69
+ end
70
+
71
+ class APITimeoutError < EInvoiceAPI::Errors::APIConnectionError
72
+ # @api private
73
+ #
74
+ # @param url [URI::Generic]
75
+ # @param status [nil]
76
+ # @param body [nil]
77
+ # @param request [nil]
78
+ # @param response [nil]
79
+ # @param message [String, nil]
80
+ def initialize(
81
+ url:,
82
+ status: nil,
83
+ body: nil,
84
+ request: nil,
85
+ response: nil,
86
+ message: "Request timed out."
87
+ )
88
+ super
89
+ end
90
+ end
91
+
92
+ class APIStatusError < EInvoiceAPI::Errors::APIError
93
+ # @api private
94
+ #
95
+ # @param url [URI::Generic]
96
+ # @param status [Integer]
97
+ # @param body [Object, nil]
98
+ # @param request [nil]
99
+ # @param response [nil]
100
+ # @param message [String, nil]
101
+ #
102
+ # @return [self]
103
+ def self.for(url:, status:, body:, request:, response:, message: nil)
104
+ kwargs = {
105
+ url: url,
106
+ status: status,
107
+ body: body,
108
+ request: request,
109
+ response: response,
110
+ message: message
111
+ }
112
+
113
+ case status
114
+ in 400
115
+ EInvoiceAPI::Errors::BadRequestError.new(**kwargs)
116
+ in 401
117
+ EInvoiceAPI::Errors::AuthenticationError.new(**kwargs)
118
+ in 403
119
+ EInvoiceAPI::Errors::PermissionDeniedError.new(**kwargs)
120
+ in 404
121
+ EInvoiceAPI::Errors::NotFoundError.new(**kwargs)
122
+ in 409
123
+ EInvoiceAPI::Errors::ConflictError.new(**kwargs)
124
+ in 422
125
+ EInvoiceAPI::Errors::UnprocessableEntityError.new(**kwargs)
126
+ in 429
127
+ EInvoiceAPI::Errors::RateLimitError.new(**kwargs)
128
+ in (500..)
129
+ EInvoiceAPI::Errors::InternalServerError.new(**kwargs)
130
+ else
131
+ EInvoiceAPI::Errors::APIStatusError.new(**kwargs)
132
+ end
133
+ end
134
+
135
+ # @!parse
136
+ # # @return [Integer]
137
+ # attr_accessor :status
138
+
139
+ # @api private
140
+ #
141
+ # @param url [URI::Generic]
142
+ # @param status [Integer]
143
+ # @param body [Object, nil]
144
+ # @param request [nil]
145
+ # @param response [nil]
146
+ # @param message [String, nil]
147
+ def initialize(url:, status:, body:, request:, response:, message: nil)
148
+ message ||= {url: url.to_s, status: status, body: body}
149
+ super(
150
+ url: url,
151
+ status: status,
152
+ body: body,
153
+ request: request,
154
+ response: response,
155
+ message: message&.to_s
156
+ )
157
+ end
158
+ end
159
+
160
+ class BadRequestError < EInvoiceAPI::Errors::APIStatusError
161
+ HTTP_STATUS = 400
162
+ end
163
+
164
+ class AuthenticationError < EInvoiceAPI::Errors::APIStatusError
165
+ HTTP_STATUS = 401
166
+ end
167
+
168
+ class PermissionDeniedError < EInvoiceAPI::Errors::APIStatusError
169
+ HTTP_STATUS = 403
170
+ end
171
+
172
+ class NotFoundError < EInvoiceAPI::Errors::APIStatusError
173
+ HTTP_STATUS = 404
174
+ end
175
+
176
+ class ConflictError < EInvoiceAPI::Errors::APIStatusError
177
+ HTTP_STATUS = 409
178
+ end
179
+
180
+ class UnprocessableEntityError < EInvoiceAPI::Errors::APIStatusError
181
+ HTTP_STATUS = 422
182
+ end
183
+
184
+ class RateLimitError < EInvoiceAPI::Errors::APIStatusError
185
+ HTTP_STATUS = 429
186
+ end
187
+
188
+ class InternalServerError < EInvoiceAPI::Errors::APIStatusError
189
+ HTTP_STATUS = (500..)
190
+ end
191
+ end
192
+ end