flashpi 0.1.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 +7 -0
- data/CHANGELOG.md +25 -0
- data/LICENSE +21 -0
- data/README.en.md +379 -0
- data/README.md +383 -0
- data/lib/flashpi/api_response.rb +33 -0
- data/lib/flashpi/client.rb +112 -0
- data/lib/flashpi/errors.rb +116 -0
- data/lib/flashpi/internal/engine.rb +355 -0
- data/lib/flashpi/internal/json_text.rb +108 -0
- data/lib/flashpi/internal/multipart.rb +141 -0
- data/lib/flashpi/internal/problems.rb +111 -0
- data/lib/flashpi/internal/request.rb +231 -0
- data/lib/flashpi/internal/resource.rb +125 -0
- data/lib/flashpi/internal/secret.rb +41 -0
- data/lib/flashpi/internal/settings.rb +88 -0
- data/lib/flashpi/internal/transport.rb +432 -0
- data/lib/flashpi/internal/validate.rb +122 -0
- data/lib/flashpi/page.rb +82 -0
- data/lib/flashpi/resources/documents.rb +136 -0
- data/lib/flashpi/resources/events.rb +36 -0
- data/lib/flashpi/resources/issuer_onboardings.rb +47 -0
- data/lib/flashpi/resources/issuers.rb +179 -0
- data/lib/flashpi/resources/webhook_endpoints.rb +110 -0
- data/lib/flashpi/version.rb +6 -0
- data/lib/flashpi/webhooks.rb +223 -0
- data/lib/flashpi.rb +42 -0
- data/sig/flashpi/internal.rbs +376 -0
- data/sig/flashpi/resources.rbs +712 -0
- data/sig/flashpi/sdk_types.rbs +114 -0
- data/sig/flashpi/types.rbs +2495 -0
- data/sig/flashpi.rbs +187 -0
- data/sig/manifest.yaml +8 -0
- metadata +80 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Types written by hand where the SDK adds something to the generated ones (types.rbs): shorter
|
|
2
|
+
# names, the webhook bodies, the open error code unions, list filters, uploads, the XML of a
|
|
3
|
+
# document and the per-call options.
|
|
4
|
+
module Flashpi
|
|
5
|
+
module Types
|
|
6
|
+
# Languages the API writes its messages in. Error codes are the same in both.
|
|
7
|
+
type language = "en" | "es"
|
|
8
|
+
|
|
9
|
+
# A language as the SDK takes it: `"es"` or `:es`.
|
|
10
|
+
type request_language = language | :en | :es | String
|
|
11
|
+
|
|
12
|
+
# `test` (SRI pruebas, fp_test_ keys) or `live` (SRI production, fp_live_ keys).
|
|
13
|
+
type environment = document_environment
|
|
14
|
+
|
|
15
|
+
# Seconds, as the timeouts take them.
|
|
16
|
+
type seconds = Integer | Float
|
|
17
|
+
|
|
18
|
+
# Header names to values.
|
|
19
|
+
type headers = Hash[String | Symbol, String]
|
|
20
|
+
|
|
21
|
+
# The body of a webhook endpoint in thin mode: the event without `data`.
|
|
22
|
+
type thin_event = event_thin
|
|
23
|
+
|
|
24
|
+
# Every event type the API sends today. New types may appear: keep a default branch.
|
|
25
|
+
type event_type = document_event_type | certificate_event_type | account_event_type
|
|
26
|
+
|
|
27
|
+
# What a webhook endpoint receives, as `Flashpi::Webhooks.unwrap` returns it: an event, whose
|
|
28
|
+
# `data` is the document, the certificate or the account's email sending; the activation
|
|
29
|
+
# handshake (`webhook_endpoint.verification`), which must be answered with
|
|
30
|
+
# `{ challenge: event[:data][:challenge] }`; or, in thin mode, an event without `data`. Branch
|
|
31
|
+
# on `event[:type]`. It is one record with the members every event has, since Steep cannot
|
|
32
|
+
# narrow a union of records on `type`; the exact shapes are `document_event`,
|
|
33
|
+
# `certificate_event`, `account_event`, `webhook_endpoint_verification_event` and
|
|
34
|
+
# `thin_event`.
|
|
35
|
+
type webhook_event = {
|
|
36
|
+
id: String,
|
|
37
|
+
type: event_type | "webhook_endpoint.verification",
|
|
38
|
+
environment: environment,
|
|
39
|
+
createdAt: String,
|
|
40
|
+
?data: untyped
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# What a webhook endpoint in thin mode receives.
|
|
44
|
+
type thin_webhook_event = thin_event | webhook_endpoint_verification_event
|
|
45
|
+
|
|
46
|
+
# An error code of the API (`code` of the Problem Details). New codes can appear before this
|
|
47
|
+
# gem knows them, so any String is accepted.
|
|
48
|
+
type api_error_code = error_code | String
|
|
49
|
+
|
|
50
|
+
# A field error code (`errors[].code`, such as `required` or `invalid_check_digit`). The list
|
|
51
|
+
# is open: new codes can appear before this gem knows them, so any String is accepted.
|
|
52
|
+
type api_field_error_code = field_error_code | String
|
|
53
|
+
|
|
54
|
+
# The Problem Details body of an API error (RFC 9457), with the extension members some codes
|
|
55
|
+
# add (`documentId`, `limit`, `resetsAt`, `rideStatus`, `expectedTotal`, ...); others may
|
|
56
|
+
# appear.
|
|
57
|
+
type problem = Hash[Symbol, untyped]
|
|
58
|
+
|
|
59
|
+
# Filters of `documents.list`.
|
|
60
|
+
type document_list_params = documents_list_query
|
|
61
|
+
|
|
62
|
+
# Filters of `events.list`.
|
|
63
|
+
type event_list_params = events_list_query
|
|
64
|
+
|
|
65
|
+
# Filters of `webhook_endpoints.deliveries.list`.
|
|
66
|
+
type webhook_delivery_list_params = webhook_endpoints_deliveries_list_query
|
|
67
|
+
|
|
68
|
+
# Paging of `issuers.list`.
|
|
69
|
+
type issuer_list_params = issuers_list_query
|
|
70
|
+
|
|
71
|
+
# Paging of `issuers.establishments.list`.
|
|
72
|
+
type establishment_list_params = establishments_list_query
|
|
73
|
+
|
|
74
|
+
# Paging of `issuers.establishments.emission_points.list`.
|
|
75
|
+
type emission_point_list_params = emission_points_list_query
|
|
76
|
+
|
|
77
|
+
# Paging of `issuers.certificates.list`.
|
|
78
|
+
type certificate_list_params = certificates_list_query
|
|
79
|
+
|
|
80
|
+
# Paging of `webhook_endpoints.list`.
|
|
81
|
+
type webhook_endpoint_list_params = webhook_endpoints_list_query
|
|
82
|
+
|
|
83
|
+
# Something to read a .p12 from: its bytes, or an IO opened in binary mode.
|
|
84
|
+
interface _Reader
|
|
85
|
+
def read: (Integer length) -> String?
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# A .p12 upload, for `issuers.certificates.upload` and `issuer_onboardings.create`.
|
|
89
|
+
type certificate_upload = {
|
|
90
|
+
# The .p12: its bytes (`File.binread("firma.p12")`) or an IO opened in binary mode
|
|
91
|
+
# (`File.open("firma.p12", "rb")`), at most 1 MiB.
|
|
92
|
+
file: String | _Reader,
|
|
93
|
+
|
|
94
|
+
# Its password.
|
|
95
|
+
password: String,
|
|
96
|
+
|
|
97
|
+
# The file name sent with it (default `certificate.p12`).
|
|
98
|
+
?filename: String
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Which stage an XML comes from. Only `authorized` is the valid tax document.
|
|
102
|
+
type document_xml_kind = "authorized" | "signed" | "unsigned"
|
|
103
|
+
|
|
104
|
+
# The XML of a document (`documents.xml`).
|
|
105
|
+
type document_xml = {
|
|
106
|
+
# The XML text.
|
|
107
|
+
xml: String,
|
|
108
|
+
|
|
109
|
+
# `authorized` (the SRI's authorization, the valid tax document), `signed` (signed, not yet
|
|
110
|
+
# authorized) or `unsigned` (before signing); nil when the API did not say.
|
|
111
|
+
kind: document_xml_kind?
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
end
|