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
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < EInvoiceAPI::Internal::Type::BaseModel
10
+ # @api private
11
+ #
12
+ # @param opts [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}]
13
+ #
14
+ # @raise [ArgumentError]
15
+ def self.validate!(opts)
16
+ case opts
17
+ in EInvoiceAPI::RequestOptions | Hash
18
+ opts.to_h.each_key do |k|
19
+ unless fields.include?(k)
20
+ raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
21
+ end
22
+ end
23
+ else
24
+ raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
25
+ end
26
+ end
27
+
28
+ # @!attribute idempotency_key
29
+ # Idempotency key to send with request and all associated retries. Will only be
30
+ # sent for write requests.
31
+ #
32
+ # @return [String, nil]
33
+ optional :idempotency_key, String
34
+
35
+ # @!attribute extra_query
36
+ # Extra query params to send with the request. These are `.merge`’d into any
37
+ # `query` given at the client level.
38
+ #
39
+ # @return [Hash{String=>Array<String>, String, nil}, nil]
40
+ optional :extra_query, EInvoiceAPI::Internal::Type::HashOf[EInvoiceAPI::Internal::Type::ArrayOf[String]]
41
+
42
+ # @!attribute extra_headers
43
+ # Extra headers to send with the request. These are `.merged`’d into any
44
+ # `extra_headers` given at the client level.
45
+ #
46
+ # @return [Hash{String=>String, nil}, nil]
47
+ optional :extra_headers, EInvoiceAPI::Internal::Type::HashOf[String, nil?: true]
48
+
49
+ # @!attribute extra_body
50
+ # Extra data to send with the request. These are deep merged into any data
51
+ # generated as part of the normal request.
52
+ #
53
+ # @return [Object, nil]
54
+ optional :extra_body, EInvoiceAPI::Internal::Type::HashOf[EInvoiceAPI::Internal::Type::Unknown]
55
+
56
+ # @!attribute max_retries
57
+ # Maximum number of retries to attempt after a failed initial request.
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :max_retries, Integer
61
+
62
+ # @!attribute timeout
63
+ # Request timeout in seconds.
64
+ #
65
+ # @return [Float, nil]
66
+ optional :timeout, Float
67
+
68
+ # @!method initialize(values = {})
69
+ # Returns a new instance of RequestOptions.
70
+ #
71
+ # @param values [Hash{Symbol=>Object}]
72
+
73
+ define_sorbet_constant!(:OrHash) do
74
+ T.type_alias { T.any(EInvoiceAPI::RequestOptions, EInvoiceAPI::Internal::AnyHash) }
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Documents
6
+ class Attachments
7
+ # Get attachment details with for an invoice or credit note with link to download
8
+ # file (signed URL, valid for 1 hour)
9
+ #
10
+ # @overload retrieve(attachment_id, document_id:, request_options: {})
11
+ #
12
+ # @param attachment_id [String]
13
+ # @param document_id [String]
14
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
15
+ #
16
+ # @return [EInvoiceAPI::Models::Documents::DocumentAttachment]
17
+ #
18
+ # @see EInvoiceAPI::Models::Documents::AttachmentRetrieveParams
19
+ def retrieve(attachment_id, params)
20
+ parsed, options = EInvoiceAPI::Documents::AttachmentRetrieveParams.dump_request(params)
21
+ document_id =
22
+ parsed.delete(:document_id) do
23
+ raise ArgumentError.new("missing required path argument #{_1}")
24
+ end
25
+ @client.request(
26
+ method: :get,
27
+ path: ["api/documents/%1$s/attachments/%2$s", document_id, attachment_id],
28
+ model: EInvoiceAPI::Documents::DocumentAttachment,
29
+ options: options
30
+ )
31
+ end
32
+
33
+ # Get all attachments for an invoice or credit note
34
+ #
35
+ # @overload list(document_id, request_options: {})
36
+ #
37
+ # @param document_id [String]
38
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
39
+ #
40
+ # @return [Array<EInvoiceAPI::Models::Documents::DocumentAttachment>]
41
+ #
42
+ # @see EInvoiceAPI::Models::Documents::AttachmentListParams
43
+ def list(document_id, params = {})
44
+ @client.request(
45
+ method: :get,
46
+ path: ["api/documents/%1$s/attachments", document_id],
47
+ model: EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::Documents::DocumentAttachment],
48
+ options: params[:request_options]
49
+ )
50
+ end
51
+
52
+ # Delete an attachment from an invoice or credit note
53
+ #
54
+ # @overload delete(attachment_id, document_id:, request_options: {})
55
+ #
56
+ # @param attachment_id [String]
57
+ # @param document_id [String]
58
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
59
+ #
60
+ # @return [EInvoiceAPI::Models::Documents::AttachmentDeleteResponse]
61
+ #
62
+ # @see EInvoiceAPI::Models::Documents::AttachmentDeleteParams
63
+ def delete(attachment_id, params)
64
+ parsed, options = EInvoiceAPI::Documents::AttachmentDeleteParams.dump_request(params)
65
+ document_id =
66
+ parsed.delete(:document_id) do
67
+ raise ArgumentError.new("missing required path argument #{_1}")
68
+ end
69
+ @client.request(
70
+ method: :delete,
71
+ path: ["api/documents/%1$s/attachments/%2$s", document_id, attachment_id],
72
+ model: EInvoiceAPI::Models::Documents::AttachmentDeleteResponse,
73
+ options: options
74
+ )
75
+ end
76
+
77
+ # Add a new attachment to an invoice or credit note
78
+ #
79
+ # @overload add(document_id, file:, request_options: {})
80
+ #
81
+ # @param document_id [String]
82
+ # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
83
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
84
+ #
85
+ # @return [EInvoiceAPI::Models::Documents::DocumentAttachment]
86
+ #
87
+ # @see EInvoiceAPI::Models::Documents::AttachmentAddParams
88
+ def add(document_id, params)
89
+ parsed, options = EInvoiceAPI::Documents::AttachmentAddParams.dump_request(params)
90
+ @client.request(
91
+ method: :post,
92
+ path: ["api/documents/%1$s/attachments", document_id],
93
+ headers: {"content-type" => "multipart/form-data"},
94
+ body: parsed,
95
+ model: EInvoiceAPI::Documents::DocumentAttachment,
96
+ options: options
97
+ )
98
+ end
99
+
100
+ # @api private
101
+ #
102
+ # @param client [EInvoiceAPI::Client]
103
+ def initialize(client:)
104
+ @client = client
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Documents
6
+ class Ubl
7
+ # Get the UBL for an invoice or credit note
8
+ #
9
+ # @overload get(document_id, request_options: {})
10
+ #
11
+ # @param document_id [String]
12
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [EInvoiceAPI::Models::Documents::UblGetResponse]
15
+ #
16
+ # @see EInvoiceAPI::Models::Documents::UblGetParams
17
+ def get(document_id, params = {})
18
+ @client.request(
19
+ method: :get,
20
+ path: ["api/documents/%1$s/ubl", document_id],
21
+ model: EInvoiceAPI::Models::Documents::UblGetResponse,
22
+ options: params[:request_options]
23
+ )
24
+ end
25
+
26
+ # @api private
27
+ #
28
+ # @param client [EInvoiceAPI::Client]
29
+ def initialize(client:)
30
+ @client = client
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,188 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Documents
6
+ # @return [EInvoiceAPI::Resources::Documents::Attachments]
7
+ attr_reader :attachments
8
+
9
+ # @return [EInvoiceAPI::Resources::Documents::Ubl]
10
+ attr_reader :ubl
11
+
12
+ # Create a new invoice or credit note
13
+ #
14
+ # @overload create(amount_due: nil, attachments: nil, billing_address: nil, billing_address_recipient: nil, currency: nil, customer_address: nil, customer_address_recipient: nil, customer_email: nil, customer_id: nil, customer_name: nil, customer_tax_id: nil, direction: nil, document_type: nil, due_date: nil, invoice_date: nil, invoice_id: nil, invoice_total: nil, items: nil, note: nil, payment_details: nil, payment_term: nil, previous_unpaid_balance: nil, purchase_order: nil, remittance_address: nil, remittance_address_recipient: nil, service_address: nil, service_address_recipient: nil, service_end_date: nil, service_start_date: nil, shipping_address: nil, shipping_address_recipient: nil, state: nil, subtotal: nil, tax_details: nil, total_discount: nil, total_tax: nil, vendor_address: nil, vendor_address_recipient: nil, vendor_email: nil, vendor_name: nil, vendor_tax_id: nil, request_options: {})
15
+ #
16
+ # @param amount_due [Float, String, nil]
17
+ #
18
+ # @param attachments [Array<EInvoiceAPI::Models::DocumentAttachmentCreate>, nil]
19
+ #
20
+ # @param billing_address [String, nil]
21
+ #
22
+ # @param billing_address_recipient [String, nil]
23
+ #
24
+ # @param currency [Symbol, EInvoiceAPI::Models::CurrencyCode] Currency of the invoice
25
+ #
26
+ # @param customer_address [String, nil]
27
+ #
28
+ # @param customer_address_recipient [String, nil]
29
+ #
30
+ # @param customer_email [String, nil]
31
+ #
32
+ # @param customer_id [String, nil]
33
+ #
34
+ # @param customer_name [String, nil]
35
+ #
36
+ # @param customer_tax_id [String, nil]
37
+ #
38
+ # @param direction [Symbol, EInvoiceAPI::Models::DocumentDirection]
39
+ #
40
+ # @param document_type [Symbol, EInvoiceAPI::Models::DocumentType]
41
+ #
42
+ # @param due_date [Date, nil]
43
+ #
44
+ # @param invoice_date [Date, nil]
45
+ #
46
+ # @param invoice_id [String, nil]
47
+ #
48
+ # @param invoice_total [Float, String, nil]
49
+ #
50
+ # @param items [Array<EInvoiceAPI::Models::DocumentCreate::Item>, nil]
51
+ #
52
+ # @param note [String, nil]
53
+ #
54
+ # @param payment_details [Array<EInvoiceAPI::Models::PaymentDetailCreate>, nil]
55
+ #
56
+ # @param payment_term [String, nil]
57
+ #
58
+ # @param previous_unpaid_balance [Float, String, nil]
59
+ #
60
+ # @param purchase_order [String, nil]
61
+ #
62
+ # @param remittance_address [String, nil]
63
+ #
64
+ # @param remittance_address_recipient [String, nil]
65
+ #
66
+ # @param service_address [String, nil]
67
+ #
68
+ # @param service_address_recipient [String, nil]
69
+ #
70
+ # @param service_end_date [Date, nil]
71
+ #
72
+ # @param service_start_date [Date, nil]
73
+ #
74
+ # @param shipping_address [String, nil]
75
+ #
76
+ # @param shipping_address_recipient [String, nil]
77
+ #
78
+ # @param state [Symbol, EInvoiceAPI::Models::DocumentState]
79
+ #
80
+ # @param subtotal [Float, String, nil]
81
+ #
82
+ # @param tax_details [Array<EInvoiceAPI::Models::DocumentCreate::TaxDetail>, nil]
83
+ #
84
+ # @param total_discount [Float, String, nil]
85
+ #
86
+ # @param total_tax [Float, String, nil]
87
+ #
88
+ # @param vendor_address [String, nil]
89
+ #
90
+ # @param vendor_address_recipient [String, nil]
91
+ #
92
+ # @param vendor_email [String, nil]
93
+ #
94
+ # @param vendor_name [String, nil]
95
+ #
96
+ # @param vendor_tax_id [String, nil]
97
+ #
98
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
99
+ #
100
+ # @return [EInvoiceAPI::Models::DocumentResponse]
101
+ #
102
+ # @see EInvoiceAPI::Models::DocumentCreateParams
103
+ def create(params = {})
104
+ parsed, options = EInvoiceAPI::DocumentCreateParams.dump_request(params)
105
+ @client.request(
106
+ method: :post,
107
+ path: "api/documents/",
108
+ body: parsed,
109
+ model: EInvoiceAPI::DocumentResponse,
110
+ options: options
111
+ )
112
+ end
113
+
114
+ # Get an invoice or credit note by ID
115
+ #
116
+ # @overload retrieve(document_id, request_options: {})
117
+ #
118
+ # @param document_id [String]
119
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
120
+ #
121
+ # @return [EInvoiceAPI::Models::DocumentResponse]
122
+ #
123
+ # @see EInvoiceAPI::Models::DocumentRetrieveParams
124
+ def retrieve(document_id, params = {})
125
+ @client.request(
126
+ method: :get,
127
+ path: ["api/documents/%1$s", document_id],
128
+ model: EInvoiceAPI::DocumentResponse,
129
+ options: params[:request_options]
130
+ )
131
+ end
132
+
133
+ # Delete an invoice or credit note
134
+ #
135
+ # @overload delete(document_id, request_options: {})
136
+ #
137
+ # @param document_id [String]
138
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
139
+ #
140
+ # @return [EInvoiceAPI::Models::DocumentDeleteResponse]
141
+ #
142
+ # @see EInvoiceAPI::Models::DocumentDeleteParams
143
+ def delete(document_id, params = {})
144
+ @client.request(
145
+ method: :delete,
146
+ path: ["api/documents/%1$s", document_id],
147
+ model: EInvoiceAPI::Models::DocumentDeleteResponse,
148
+ options: params[:request_options]
149
+ )
150
+ end
151
+
152
+ # Send an invoice or credit note via Peppol
153
+ #
154
+ # @overload send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {})
155
+ #
156
+ # @param document_id [String]
157
+ # @param email [String, nil]
158
+ # @param receiver_peppol_id [String, nil]
159
+ # @param receiver_peppol_scheme [String, nil]
160
+ # @param sender_peppol_id [String, nil]
161
+ # @param sender_peppol_scheme [String, nil]
162
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
163
+ #
164
+ # @return [EInvoiceAPI::Models::DocumentResponse]
165
+ #
166
+ # @see EInvoiceAPI::Models::DocumentSendParams
167
+ def send_(document_id, params = {})
168
+ parsed, options = EInvoiceAPI::DocumentSendParams.dump_request(params)
169
+ @client.request(
170
+ method: :post,
171
+ path: ["api/documents/%1$s/send", document_id],
172
+ query: parsed,
173
+ model: EInvoiceAPI::DocumentResponse,
174
+ options: options
175
+ )
176
+ end
177
+
178
+ # @api private
179
+ #
180
+ # @param client [EInvoiceAPI::Client]
181
+ def initialize(client:)
182
+ @client = client
183
+ @attachments = EInvoiceAPI::Resources::Documents::Attachments.new(client: client)
184
+ @ubl = EInvoiceAPI::Resources::Documents::Ubl.new(client: client)
185
+ end
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Inbox
6
+ # Retrieve a paginated list of received documents with filtering options.
7
+ #
8
+ # @overload list(date_from: nil, date_to: nil, page: nil, page_size: nil, search: nil, sender: nil, state: nil, type: nil, request_options: {})
9
+ #
10
+ # @param date_from [Time, nil] Filter by issue date (from)
11
+ #
12
+ # @param date_to [Time, nil] Filter by issue date (to)
13
+ #
14
+ # @param page [Integer] Page number
15
+ #
16
+ # @param page_size [Integer] Number of items per page
17
+ #
18
+ # @param search [String, nil] Search in invoice number, seller/buyer names
19
+ #
20
+ # @param sender [String, nil] Filter by sender ID
21
+ #
22
+ # @param state [Symbol, EInvoiceAPI::Models::DocumentState, nil] Filter by document state
23
+ #
24
+ # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type
25
+ #
26
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
27
+ #
28
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
29
+ #
30
+ # @see EInvoiceAPI::Models::InboxListParams
31
+ def list(params = {})
32
+ parsed, options = EInvoiceAPI::InboxListParams.dump_request(params)
33
+ @client.request(
34
+ method: :get,
35
+ path: "api/inbox/",
36
+ query: parsed,
37
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
38
+ model: EInvoiceAPI::DocumentResponse,
39
+ options: options
40
+ )
41
+ end
42
+
43
+ # Retrieve a paginated list of received credit notes with filtering options.
44
+ #
45
+ # @overload list_credit_notes(page: nil, page_size: nil, request_options: {})
46
+ #
47
+ # @param page [Integer] Page number
48
+ #
49
+ # @param page_size [Integer] Number of items per page
50
+ #
51
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
52
+ #
53
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
54
+ #
55
+ # @see EInvoiceAPI::Models::InboxListCreditNotesParams
56
+ def list_credit_notes(params = {})
57
+ parsed, options = EInvoiceAPI::InboxListCreditNotesParams.dump_request(params)
58
+ @client.request(
59
+ method: :get,
60
+ path: "api/inbox/credit-notes",
61
+ query: parsed,
62
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
63
+ model: EInvoiceAPI::DocumentResponse,
64
+ options: options
65
+ )
66
+ end
67
+
68
+ # Retrieve a paginated list of received invoices with filtering options.
69
+ #
70
+ # @overload list_invoices(page: nil, page_size: nil, request_options: {})
71
+ #
72
+ # @param page [Integer] Page number
73
+ #
74
+ # @param page_size [Integer] Number of items per page
75
+ #
76
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
77
+ #
78
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
79
+ #
80
+ # @see EInvoiceAPI::Models::InboxListInvoicesParams
81
+ def list_invoices(params = {})
82
+ parsed, options = EInvoiceAPI::InboxListInvoicesParams.dump_request(params)
83
+ @client.request(
84
+ method: :get,
85
+ path: "api/inbox/invoices",
86
+ query: parsed,
87
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
88
+ model: EInvoiceAPI::DocumentResponse,
89
+ options: options
90
+ )
91
+ end
92
+
93
+ # @api private
94
+ #
95
+ # @param client [EInvoiceAPI::Client]
96
+ def initialize(client:)
97
+ @client = client
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Lookup
6
+ # Some parameter documentations has been truncated, see
7
+ # {EInvoiceAPI::Models::LookupRetrieveParams} for more details.
8
+ #
9
+ # Lookup Peppol ID. The peppol_id must be in the form of `<scheme>:<id>`. The
10
+ # scheme is a 4-digit code representing the identifier scheme, and the id is the
11
+ # actual identifier value. For example, for a Belgian company it is
12
+ # `0208:0123456789` (where 0208 is the scheme for Belgian enterprises, followed by
13
+ # the 10 digits of the official BTW / KBO number).
14
+ #
15
+ # @overload retrieve(peppol_id:, request_options: {})
16
+ #
17
+ # @param peppol_id [String] Peppol ID in the format `<scheme>:<id>`. Example: `0208:1018265814` for a Belgia
18
+ #
19
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
20
+ #
21
+ # @return [EInvoiceAPI::Models::LookupRetrieveResponse]
22
+ #
23
+ # @see EInvoiceAPI::Models::LookupRetrieveParams
24
+ def retrieve(params)
25
+ parsed, options = EInvoiceAPI::LookupRetrieveParams.dump_request(params)
26
+ @client.request(
27
+ method: :get,
28
+ path: "api/lookup",
29
+ query: parsed,
30
+ model: EInvoiceAPI::Models::LookupRetrieveResponse,
31
+ options: options
32
+ )
33
+ end
34
+
35
+ # @api private
36
+ #
37
+ # @param client [EInvoiceAPI::Client]
38
+ def initialize(client:)
39
+ @client = client
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Outbox
6
+ # Retrieve a paginated list of draft documents with filtering options.
7
+ #
8
+ # @overload list_draft_documents(page: nil, page_size: nil, request_options: {})
9
+ #
10
+ # @param page [Integer] Page number
11
+ #
12
+ # @param page_size [Integer] Number of items per page
13
+ #
14
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
15
+ #
16
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
17
+ #
18
+ # @see EInvoiceAPI::Models::OutboxListDraftDocumentsParams
19
+ def list_draft_documents(params = {})
20
+ parsed, options = EInvoiceAPI::OutboxListDraftDocumentsParams.dump_request(params)
21
+ @client.request(
22
+ method: :get,
23
+ path: "api/outbox/drafts",
24
+ query: parsed,
25
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
26
+ model: EInvoiceAPI::DocumentResponse,
27
+ options: options
28
+ )
29
+ end
30
+
31
+ # Retrieve a paginated list of received documents with filtering options.
32
+ #
33
+ # @overload list_received_documents(date_from: nil, date_to: nil, page: nil, page_size: nil, search: nil, sender: nil, state: nil, type: nil, request_options: {})
34
+ #
35
+ # @param date_from [Time, nil] Filter by issue date (from)
36
+ #
37
+ # @param date_to [Time, nil] Filter by issue date (to)
38
+ #
39
+ # @param page [Integer] Page number
40
+ #
41
+ # @param page_size [Integer] Number of items per page
42
+ #
43
+ # @param search [String, nil] Search in invoice number, seller/buyer names
44
+ #
45
+ # @param sender [String, nil] Filter by sender ID
46
+ #
47
+ # @param state [Symbol, EInvoiceAPI::Models::DocumentState, nil] Filter by document state
48
+ #
49
+ # @param type [Symbol, EInvoiceAPI::Models::DocumentType, nil] Filter by document type
50
+ #
51
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
52
+ #
53
+ # @return [EInvoiceAPI::Internal::DocumentsNumberPage<EInvoiceAPI::Models::DocumentResponse>]
54
+ #
55
+ # @see EInvoiceAPI::Models::OutboxListReceivedDocumentsParams
56
+ def list_received_documents(params = {})
57
+ parsed, options = EInvoiceAPI::OutboxListReceivedDocumentsParams.dump_request(params)
58
+ @client.request(
59
+ method: :get,
60
+ path: "api/outbox/",
61
+ query: parsed,
62
+ page: EInvoiceAPI::Internal::DocumentsNumberPage,
63
+ model: EInvoiceAPI::DocumentResponse,
64
+ options: options
65
+ )
66
+ end
67
+
68
+ # @api private
69
+ #
70
+ # @param client [EInvoiceAPI::Client]
71
+ def initialize(client:)
72
+ @client = client
73
+ end
74
+ end
75
+ end
76
+ end