galaxy-ruby 0.4.0 → 0.6.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 +188 -0
- data/README.md +26 -5
- data/SKILL.md +6 -4
- data/api.md +8 -8
- data/lib/galaxy-ruby/client.rb +52 -41
- data/lib/galaxy-ruby/errors.rb +40 -0
- data/lib/galaxy-ruby/file_part.rb +13 -1
- data/lib/galaxy-ruby/internal/transport/base_client.rb +278 -42
- data/lib/galaxy-ruby/internal/transport/connection_pool.rb +160 -0
- data/lib/galaxy-ruby/internal/transport/pooled_net_requester.rb +77 -10
- data/lib/galaxy-ruby/internal/type/base_model.rb +62 -17
- data/lib/galaxy-ruby/internal/type/boolean.rb +3 -1
- data/lib/galaxy-ruby/internal/type/converter.rb +13 -3
- data/lib/galaxy-ruby/internal/type/enum.rb +9 -4
- data/lib/galaxy-ruby/internal/type/file_input.rb +8 -2
- data/lib/galaxy-ruby/internal/type/hash_of.rb +3 -1
- data/lib/galaxy-ruby/internal/type/union.rb +17 -6
- data/lib/galaxy-ruby/internal/type/unknown.rb +3 -1
- data/lib/galaxy-ruby/internal/util.rb +273 -15
- data/lib/galaxy-ruby/internal/webhook_verifier.rb +240 -0
- data/lib/galaxy-ruby/internal.rb +4 -1
- data/lib/galaxy-ruby/models/authentication_create_token_params.rb +7 -1
- data/lib/galaxy-ruby/models/authentication_create_user_params.rb +2 -0
- data/lib/galaxy-ruby/models/celestial_body_create_params.rb +3 -3
- data/lib/galaxy-ruby/models/celestial_body_param.rb +72 -0
- data/lib/galaxy-ruby/models/credentials.rb +1 -9
- data/lib/galaxy-ruby/models/planet_create_params.rb +11 -1
- data/lib/galaxy-ruby/models/{planet_list_all_data_params.rb → planet_list_params.rb} +2 -2
- data/lib/galaxy-ruby/models/{planet_list_all_data_response.rb → planet_list_response.rb} +9 -9
- data/lib/galaxy-ruby/models/planet_param.rb +204 -0
- data/lib/galaxy-ruby/models/planet_update_params.rb +12 -1
- data/lib/galaxy-ruby/models/{planet_delte_image_params.rb → planet_upload_image_params.rb} +2 -2
- data/lib/galaxy-ruby/models/{planet_delte_image_response.rb → planet_upload_image_response.rb} +2 -2
- data/lib/galaxy-ruby/models/user_param.rb +19 -0
- data/lib/galaxy-ruby/models/webhook_unwrap_params.rb +2 -0
- data/lib/galaxy-ruby/models.rb +38 -33
- data/lib/galaxy-ruby/request_options.rb +13 -5
- data/lib/galaxy-ruby/resources/celestial_bodies.rb +1 -1
- data/lib/galaxy-ruby/resources/planets.rb +37 -47
- data/lib/galaxy-ruby/resources/webhooks.rb +63 -6
- data/lib/galaxy-ruby/version.rb +1 -1
- data/lib/galaxy-ruby.rb +12 -10
- data/rbi/galaxy-ruby/client.rbi +28 -5
- data/rbi/galaxy-ruby/errors.rbi +25 -27
- data/rbi/galaxy-ruby/internal/transport/base_client.rbi +88 -68
- data/rbi/galaxy-ruby/internal/transport/connection_pool.rbi +44 -0
- data/rbi/galaxy-ruby/internal/transport/pooled_net_requester.rbi +18 -19
- data/rbi/galaxy-ruby/internal/type/base_model.rbi +27 -49
- data/rbi/galaxy-ruby/internal/type/base_page.rbi +1 -2
- data/rbi/galaxy-ruby/internal/type/converter.rbi +12 -51
- data/rbi/galaxy-ruby/internal/type/enum.rbi +1 -5
- data/rbi/galaxy-ruby/internal/type/request_parameters.rbi +2 -6
- data/rbi/galaxy-ruby/internal/type/union.rbi +2 -11
- data/rbi/galaxy-ruby/internal/util.rbi +101 -115
- data/rbi/galaxy-ruby/internal/webhook_verifier.rbi +86 -0
- data/rbi/galaxy-ruby/internal.rbi +1 -4
- data/rbi/galaxy-ruby/models/authentication_create_token_params.rbi +11 -5
- data/rbi/galaxy-ruby/models/celestial_body_create_params.rbi +8 -5
- data/rbi/galaxy-ruby/models/celestial_body_param.rbi +138 -0
- data/rbi/galaxy-ruby/models/credentials.rbi +2 -5
- data/rbi/galaxy-ruby/models/planet_create_params.rbi +22 -5
- data/rbi/galaxy-ruby/models/{planet_list_all_data_params.rbi → planet_list_params.rbi} +2 -5
- data/rbi/galaxy-ruby/models/{planet_list_all_data_response.rbi → planet_list_response.rbi} +11 -15
- data/rbi/galaxy-ruby/models/planet_param.rbi +346 -0
- data/rbi/galaxy-ruby/models/planet_update_params.rbi +19 -2
- data/rbi/galaxy-ruby/models/{planet_delte_image_params.rbi → planet_upload_image_params.rbi} +2 -2
- data/rbi/galaxy-ruby/models/{planet_delte_image_response.rbi → planet_upload_image_response.rbi} +2 -2
- data/rbi/galaxy-ruby/models/unwrap_webhook_event.rbi +1 -1
- data/rbi/galaxy-ruby/models/user_param.rbi +27 -0
- data/rbi/galaxy-ruby/models/webhook_unwrap_params.rbi +2 -0
- data/rbi/galaxy-ruby/models.rbi +10 -2
- data/rbi/galaxy-ruby/request_options.rbi +4 -10
- data/rbi/galaxy-ruby/resources/celestial_bodies.rbi +2 -2
- data/rbi/galaxy-ruby/resources/planets.rbi +22 -30
- data/rbi/galaxy-ruby/resources/webhooks.rbi +64 -3
- data/sig/galaxy-ruby/client.rbs +13 -5
- data/sig/galaxy-ruby/errors.rbs +13 -0
- data/sig/galaxy-ruby/internal/transport/base_client.rbs +38 -2
- data/sig/galaxy-ruby/internal/transport/connection_pool.rbs +19 -0
- data/sig/galaxy-ruby/internal/transport/pooled_net_requester.rbs +13 -2
- data/sig/galaxy-ruby/internal/type/base_model.rbs +4 -0
- data/sig/galaxy-ruby/internal/util.rbs +29 -1
- data/sig/galaxy-ruby/internal/webhook_verifier.rbs +53 -0
- data/sig/galaxy-ruby/models/authentication_create_token_params.rbs +13 -3
- data/sig/galaxy-ruby/models/celestial_body_create_params.rbs +4 -4
- data/sig/galaxy-ruby/models/celestial_body_param.rbs +69 -0
- data/sig/galaxy-ruby/models/credentials.rbs +1 -3
- data/sig/galaxy-ruby/models/planet_create_params.rbs +14 -3
- data/sig/galaxy-ruby/models/{planet_list_all_data_params.rbs → planet_list_params.rbs} +2 -2
- data/sig/galaxy-ruby/models/{planet_list_all_data_response.rbs → planet_list_response.rbs} +15 -13
- data/sig/galaxy-ruby/models/planet_param.rbs +199 -0
- data/sig/galaxy-ruby/models/planet_update_params.rbs +8 -1
- data/sig/galaxy-ruby/models/{planet_delte_image_params.rbs → planet_upload_image_params.rbs} +2 -2
- data/sig/galaxy-ruby/models/{planet_delte_image_response.rbs → planet_upload_image_response.rbs} +2 -2
- data/sig/galaxy-ruby/models/user_param.rbs +15 -0
- data/sig/galaxy-ruby/models/webhook_unwrap_params.rbs +4 -0
- data/sig/galaxy-ruby/models.rbs +10 -2
- data/sig/galaxy-ruby/resources/celestial_bodies.rbs +1 -1
- data/sig/galaxy-ruby/resources/planets.rbs +10 -14
- data/sig/galaxy-ruby/resources/webhooks.rbs +17 -1
- metadata +32 -71
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec6d15f0dbe9aaf6c5fb1b0bc8c696221c2e7bee2605f999cc7ce1c67e822d1d
|
|
4
|
+
data.tar.gz: 620265ceef6d1841a51b2e23d5d75255a2c4c2df86279f0cc6fee1295f4deb4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7a7a9b4210ac5c5e1d82498f230842079e934b4fd89ec04e67d138b05fa446a9487953e0a9ba60478bd949a946be54a0c8683f52bf3b3fe6ca4d7cbe2a6d7b9
|
|
7
|
+
data.tar.gz: b692715da50904e0779cb61daa6d3fa12d94dd289fbb7ff29bd4e8432d425074ba243871069020e087810d59ef14ec54d70f3bd268e28a28bcd5bc54bb5d237e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,193 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/scalar/galaxy-ruby/compare/v0.5.0...v0.6.0) (2026-11-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* **api:** 2 breaking changes to the SDK surface.
|
|
9
|
+
- Response of `planets.list` changed from `paginated_resource` to an unnamed `application/json` body.
|
|
10
|
+
- Removed schema `paginated_resource`.
|
|
11
|
+
* **api:** 5 breaking changes to the SDK surface.
|
|
12
|
+
- Removed operation `planets.listAllData` (`GET /planets`).
|
|
13
|
+
- Removed operation `planets.delteImage` (`POST /planets/{planetId}/image`).
|
|
14
|
+
- Removed schema `ListAllDataResponseHeaders`.
|
|
15
|
+
- Removed schema `DelteImageResponseHeaders`.
|
|
16
|
+
- Removed schema `DelteImageStatus400ResponseHeaders`.
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **api:** remove operation planets.listAllData (+9 more changes) ([3a24f2a](https://github.com/scalar/galaxy-ruby/commit/3a24f2a43d1ed76e957da933732850970df72c08))
|
|
21
|
+
* **api:** update response of planets.list (+2 more changes) ([f7a2970](https://github.com/scalar/galaxy-ruby/commit/f7a29707268fb44ecfdc7dd217d965a978990f12))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Chores
|
|
25
|
+
|
|
26
|
+
* **api:** regenerate SDK ([6520b57](https://github.com/scalar/galaxy-ruby/commit/6520b5716ebeee8e38c9dd38f226ce705999ca02))
|
|
27
|
+
* **api:** regenerate SDK ([07c8a8e](https://github.com/scalar/galaxy-ruby/commit/07c8a8e6836f40a1ea49454ef2a58aba8694e2a9))
|
|
28
|
+
* **api:** update generated SDK content ([83feef2](https://github.com/scalar/galaxy-ruby/commit/83feef294b3e36eead49f89abdd128744917221b))
|
|
29
|
+
|
|
30
|
+
## [0.5.0](https://github.com/scalar/galaxy-ruby/compare/v0.4.0...v0.5.0) (2026-10-07)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### ⚠ BREAKING CHANGES
|
|
34
|
+
|
|
35
|
+
* **api:** 89 breaking changes to the SDK surface.
|
|
36
|
+
- Renamed SDK from `Scalar` to `ScalarGalaxy`.
|
|
37
|
+
- Removed server `https://access.scalar.com`.
|
|
38
|
+
- URL of environment `production` changed from `https://access.scalar.com` to `https://galaxy.scalar.com`.
|
|
39
|
+
- Removed `bearer` auth scheme `BearerAuth`.
|
|
40
|
+
- Removed operation `registry.listAllApiDocuments` (`GET /v1/apis`).
|
|
41
|
+
- Removed operation `registry.listApiDocuments` (`GET /v1/apis/{namespace}`).
|
|
42
|
+
- Removed operation `registry.createApiDocument` (`POST /v1/apis/{namespace}`).
|
|
43
|
+
- Removed operation `registry.updateApiDocument` (`PATCH /v1/apis/{namespace}/{slug}`).
|
|
44
|
+
- Removed operation `registry.deleteApiDocument` (`DELETE /v1/apis/{namespace}/{slug}`).
|
|
45
|
+
- Removed operation `registry.retrieveApiDocumentVersion` (`GET /v1/apis/{namespace}/{slug}/version/{semver}`).
|
|
46
|
+
- Removed operation `registry.updateApiDocumentVersion` (`PATCH /v1/apis/{namespace}/{slug}/version/{semver}`).
|
|
47
|
+
- Removed operation `registry.deleteApiDocumentVersion` (`DELETE /v1/apis/{namespace}/{slug}/version/{semver}`).
|
|
48
|
+
- Removed operation `registry.listApiDocumentVersionMetadata` (`GET /v1/apis/{namespace}/{slug}/version/{semver}/metadata`).
|
|
49
|
+
- Removed operation `registry.createApiDocumentVersion` (`POST /v1/apis/{namespace}/{slug}/version`).
|
|
50
|
+
- Removed operation `registry.createApiDocumentAccessGroup` (`POST /v1/apis/{namespace}/{slug}/access-group`).
|
|
51
|
+
- Removed operation `registry.deleteApiDocumentAccessGroup` (`DELETE /v1/apis/{namespace}/{slug}/access-group`).
|
|
52
|
+
- Removed operation `schemas.list` (`GET /v1/schemas/{namespace}`).
|
|
53
|
+
- Removed operation `schemas.create` (`POST /v1/schemas/{namespace}`).
|
|
54
|
+
- Removed operation `schemas.update` (`PATCH /v1/schemas/{namespace}/{slug}`).
|
|
55
|
+
- Removed operation `schemas.delete` (`DELETE /v1/schemas/{namespace}/{slug}`).
|
|
56
|
+
- Removed operation `schemas.version.retrieve` (`GET /v1/schemas/{namespace}/{slug}/version/{semver}`).
|
|
57
|
+
- Removed operation `schemas.version.delete` (`DELETE /v1/schemas/{namespace}/{slug}/version/{semver}`).
|
|
58
|
+
- Removed operation `schemas.version.create` (`POST /v1/schemas/{namespace}/{slug}/version`).
|
|
59
|
+
- Removed operation `schemas.accessGroup.create` (`POST /v1/schemas/{namespace}/{slug}/access-group`).
|
|
60
|
+
- Removed operation `schemas.accessGroup.delete` (`DELETE /v1/schemas/{namespace}/{slug}/access-group`).
|
|
61
|
+
- Removed operation `loginPortals.retrieve` (`GET /v1/login-portals/{slug}`).
|
|
62
|
+
- Removed operation `loginPortals.update` (`PATCH /v1/login-portals/{slug}`).
|
|
63
|
+
- Removed operation `loginPortals.delete` (`DELETE /v1/login-portals/{slug}`).
|
|
64
|
+
- Removed operation `loginPortals.create` (`POST /v1/login-portals`).
|
|
65
|
+
- Removed operation `loginPortals.list` (`GET /v1/login-portals`).
|
|
66
|
+
- Removed operation `rules.listRulesets` (`GET /v1/rulesets/{namespace}`).
|
|
67
|
+
- Removed operation `rules.createRuleset` (`POST /v1/rulesets/{namespace}`).
|
|
68
|
+
- Removed operation `rules.updateRuleset` (`PATCH /v1/rulesets/{namespace}/{slug}`).
|
|
69
|
+
- Removed operation `rules.deleteRuleset` (`DELETE /v1/rulesets/{namespace}/{slug}`).
|
|
70
|
+
- Removed operation `rules.retrieveRulesetDocument` (`GET /v1/rulesets/{namespace}/{slug}`).
|
|
71
|
+
- Removed operation `rules.createRulesetAccessGroup` (`POST /v1/rulesets/{namespace}/{slug}/access-group`).
|
|
72
|
+
- Removed operation `rules.deleteRulesetAccessGroup` (`DELETE /v1/rulesets/{namespace}/{slug}/access-group`).
|
|
73
|
+
- Removed operation `themes.list` (`GET /v1/themes`).
|
|
74
|
+
- Removed operation `themes.create` (`POST /v1/themes`).
|
|
75
|
+
- Removed operation `themes.update` (`PATCH /v1/themes/{slug}`).
|
|
76
|
+
- Removed operation `themes.replaceDocument` (`PUT /v1/themes/{slug}`).
|
|
77
|
+
- Removed operation `themes.delete` (`DELETE /v1/themes/{slug}`).
|
|
78
|
+
- Removed operation `themes.retrieve` (`GET /v1/themes/{slug}`).
|
|
79
|
+
- Removed operation `teams.list` (`GET /v1/teams`).
|
|
80
|
+
- Removed operation `scalarDocs.listGuides` (`GET /v1/guides`).
|
|
81
|
+
- Removed operation `scalarDocs.createGuide` (`POST /v1/guides`).
|
|
82
|
+
- Removed operation `scalarDocs.publishGuide` (`POST /v1/guides/{slug}/publish`).
|
|
83
|
+
- Removed operation `namespaces.list` (`GET /v1/namespaces`).
|
|
84
|
+
- Removed operation `authentication.exchangePersonalToken` (`POST /v1/auth/exchange`).
|
|
85
|
+
- Removed operation `authentication.listCurrentUser` (`GET /v1/auth/me`).
|
|
86
|
+
- Removed required property `user.uid`.
|
|
87
|
+
- Removed required property `user.createdAt`.
|
|
88
|
+
- Removed required property `user.updatedAt`.
|
|
89
|
+
- Removed required property `user.email`.
|
|
90
|
+
- Removed optional property `user.theme`.
|
|
91
|
+
- Removed required property `user.activeTeamId`.
|
|
92
|
+
- Removed required property `user.hasGithub`.
|
|
93
|
+
- Removed required property `user.teams`.
|
|
94
|
+
- Removed schema `400`.
|
|
95
|
+
- Removed schema `401`.
|
|
96
|
+
- Removed schema `403`.
|
|
97
|
+
- Removed schema `404`.
|
|
98
|
+
- Removed schema `422`.
|
|
99
|
+
- Removed schema `500`.
|
|
100
|
+
- Removed schema `api_document`.
|
|
101
|
+
- Removed schema `nanoid`.
|
|
102
|
+
- Removed schema `version`.
|
|
103
|
+
- Removed schema `slug`.
|
|
104
|
+
- Removed schema `namespace`.
|
|
105
|
+
- Removed schema `managed_doc_version`.
|
|
106
|
+
- Removed schema `method`.
|
|
107
|
+
- Removed schema `access_group`.
|
|
108
|
+
- Removed schema `schema`.
|
|
109
|
+
- Removed schema `managed_schema_version`.
|
|
110
|
+
- Removed schema `timestamp`.
|
|
111
|
+
- Removed schema `uid`.
|
|
112
|
+
- Removed schema `login_portal_email`.
|
|
113
|
+
- Removed schema `login_portal_page`.
|
|
114
|
+
- Removed schema `login_portal`.
|
|
115
|
+
- Removed schema `rule`.
|
|
116
|
+
- Removed schema `theme`.
|
|
117
|
+
- Removed schema `team`.
|
|
118
|
+
- Removed schema `team_name`.
|
|
119
|
+
- Removed schema `team_image`.
|
|
120
|
+
- Removed schema `github_project`.
|
|
121
|
+
- Removed schema `active_deployment`.
|
|
122
|
+
- Removed schema `github_project_repository`.
|
|
123
|
+
- Removed schema `email`.
|
|
124
|
+
- Removed schema `team_summary`.
|
|
125
|
+
* **api:** 53 breaking changes to the SDK surface.
|
|
126
|
+
- Renamed SDK from `ScalarGalaxy` to `Scalar`.
|
|
127
|
+
- Removed server `https://galaxy.scalar.com`.
|
|
128
|
+
- Removed server `{protocol}://void.scalar.com/{path}`.
|
|
129
|
+
- URL of environment `production` changed from `https://galaxy.scalar.com` to `https://access.scalar.com`.
|
|
130
|
+
- Removed environment `void`.
|
|
131
|
+
- Removed `bearer` auth scheme `bearerAuth`.
|
|
132
|
+
- Removed `basic` auth scheme `basicAuth`.
|
|
133
|
+
- Removed `apiKey` auth scheme `apiKeyHeader`.
|
|
134
|
+
- Removed `apiKey` auth scheme `apiKeyQuery`.
|
|
135
|
+
- Removed `apiKey` auth scheme `apiKeyCookie`.
|
|
136
|
+
- Removed `oauth2` auth scheme `oAuth2`.
|
|
137
|
+
- Removed `oauth2` auth scheme `openIdConnect`.
|
|
138
|
+
- Removed operation `planets.listAllData` (`GET /planets`).
|
|
139
|
+
- Removed operation `planets.create` (`POST /planets`).
|
|
140
|
+
- Removed operation `planets.retrieve` (`GET /planets/{planetId}`).
|
|
141
|
+
- Removed operation `planets.update` (`PUT /planets/{planetId}`).
|
|
142
|
+
- Removed operation `planets.delete` (`DELETE /planets/{planetId}`).
|
|
143
|
+
- Removed operation `planets.delteImage` (`POST /planets/{planetId}/image`).
|
|
144
|
+
- Removed operation `celestialBodies.create` (`POST /celestial-bodies`).
|
|
145
|
+
- Removed operation `authentication.createUser` (`POST /user/signup`).
|
|
146
|
+
- Removed operation `authentication.createToken` (`POST /auth/token`).
|
|
147
|
+
- Removed operation `authentication.listMe` (`GET /me`).
|
|
148
|
+
- Added required property `user.uid`.
|
|
149
|
+
- Added required property `user.createdAt`.
|
|
150
|
+
- Added required property `user.updatedAt`.
|
|
151
|
+
- Added required property `user.email`.
|
|
152
|
+
- Added required property `user.activeTeamId`.
|
|
153
|
+
- Added required property `user.hasGithub`.
|
|
154
|
+
- Added required property `user.teams`.
|
|
155
|
+
- Removed optional property `user.id`.
|
|
156
|
+
- Removed optional property `user.name`.
|
|
157
|
+
- Removed schema `credentials`.
|
|
158
|
+
- Removed schema `token`.
|
|
159
|
+
- Removed schema `celestial_body`.
|
|
160
|
+
- Removed schema `planet`.
|
|
161
|
+
- Removed schema `satellite`.
|
|
162
|
+
- Removed schema `paginated_resource`.
|
|
163
|
+
- Removed schema `ListAllDataResponseHeaders`.
|
|
164
|
+
- Removed schema `CreateResponseHeaders`.
|
|
165
|
+
- Removed schema `CreateStatus400ResponseHeaders`.
|
|
166
|
+
- Removed schema `RetrieveResponseHeaders`.
|
|
167
|
+
- Removed schema `UpdateStatus400ResponseHeaders`.
|
|
168
|
+
- Removed schema `DelteImageResponseHeaders`.
|
|
169
|
+
- Removed schema `DelteImageStatus400ResponseHeaders`.
|
|
170
|
+
- Removed schema `CreateUserResponseHeaders`.
|
|
171
|
+
- Removed schema `CreateUserStatus400ResponseHeaders`.
|
|
172
|
+
- Removed schema `CreateTokenResponseHeaders`.
|
|
173
|
+
- Removed schema `CreateTokenStatus400ResponseHeaders`.
|
|
174
|
+
- Removed schema `CreateTokenStatus429ResponseHeaders`.
|
|
175
|
+
- Removed schema `ListMeResponseHeaders`.
|
|
176
|
+
- Removed webhook `Unwrap` (`newPlanet`).
|
|
177
|
+
- Removed webhook `RequestBodySuccessCallbackUrl` (`{$request.body#/successCallbackUrl}`).
|
|
178
|
+
- Removed webhook `RequestBodyFailureCallbackUrl` (`{$request.body#/failureCallbackUrl}`).
|
|
179
|
+
|
|
180
|
+
### Features
|
|
181
|
+
|
|
182
|
+
* **api:** update SDK name (+132 more changes) ([ab418b2](https://github.com/scalar/galaxy-ruby/commit/ab418b29738fa7a739dcbe538fbac68b2216c995))
|
|
183
|
+
* **api:** update SDK name (+133 more changes) ([95af6d9](https://github.com/scalar/galaxy-ruby/commit/95af6d947670e9819f479f0f9810eaf4590f285d))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
### Chores
|
|
187
|
+
|
|
188
|
+
* **api:** regenerate SDK ([296e2fe](https://github.com/scalar/galaxy-ruby/commit/296e2fe1c8b029c13401b6f06a3aa37400b9cd7f))
|
|
189
|
+
* **api:** update generated SDK content ([d3cf8aa](https://github.com/scalar/galaxy-ruby/commit/d3cf8aa08ea8df077f331839be5b24fddc7bd89a))
|
|
190
|
+
|
|
3
191
|
## [0.4.0](https://github.com/scalar/galaxy-ruby/compare/v0.3.1...v0.4.0) (2026-09-15)
|
|
4
192
|
|
|
5
193
|
|
data/README.md
CHANGED
|
@@ -16,6 +16,7 @@ The full API of this library can be found in [api.md](./api.md).
|
|
|
16
16
|
- [Client Options](#client-options)
|
|
17
17
|
- [Request Options](#request-options)
|
|
18
18
|
- [Retries and Timeouts](#retries-and-timeouts)
|
|
19
|
+
- [Webhooks](#webhooks)
|
|
19
20
|
- [Helpers](#helpers)
|
|
20
21
|
- [Requirements](#requirements)
|
|
21
22
|
|
|
@@ -26,7 +27,7 @@ The full API of this library can be found in [api.md](./api.md).
|
|
|
26
27
|
Add the gem to your application's `Gemfile`:
|
|
27
28
|
|
|
28
29
|
```ruby
|
|
29
|
-
gem "galaxy-ruby", "~> 0.
|
|
30
|
+
gem "galaxy-ruby", "~> 0.6.0" # x-release-please-version
|
|
30
31
|
```
|
|
31
32
|
|
|
32
33
|
Or install it directly:
|
|
@@ -46,7 +47,7 @@ client = ScalarGalaxy::Client.new(
|
|
|
46
47
|
bearer_auth: ENV["BEARER_AUTH"], # defaults to the BEARER_AUTH env var
|
|
47
48
|
)
|
|
48
49
|
|
|
49
|
-
response = client.planets.
|
|
50
|
+
response = client.planets.list({ limit: 10, offset: 0 })
|
|
50
51
|
|
|
51
52
|
puts response.inspect
|
|
52
53
|
```
|
|
@@ -90,11 +91,13 @@ Non-success responses throw generated API errors. Error objects expose status, h
|
|
|
90
91
|
|
|
91
92
|
```ruby
|
|
92
93
|
begin
|
|
93
|
-
response = client.planets.
|
|
94
|
+
response = client.planets.list({ limit: 10, offset: 0 })
|
|
94
95
|
|
|
95
96
|
puts response.inspect
|
|
96
97
|
rescue ScalarGalaxy::Errors::APIError => error
|
|
97
98
|
puts "#{error.status}: #{error.message}"
|
|
99
|
+
puts error.request_id if error.request_id
|
|
100
|
+
puts error.problem_details if error.problem_details
|
|
98
101
|
raise
|
|
99
102
|
end
|
|
100
103
|
```
|
|
@@ -131,7 +134,7 @@ client = ScalarGalaxy::Client.new(
|
|
|
131
134
|
| `base_url` | `String \| nil` | `ENV["SCALAR_BASE_URL"]` | Override the default API base URL. |
|
|
132
135
|
| `max_retries` | `Integer` | `2` | Max number of retries to attempt after a failed retryable request. |
|
|
133
136
|
| `timeout` | `Float` | `60.0` | Seconds to wait for a response before timing out. |
|
|
134
|
-
| `initial_retry_delay` | `Float` | `0.5` |
|
|
137
|
+
| `initial_retry_delay` | `Float` | `0.5` | Base delay, in seconds, for retry backoff: the wait grows with the square of the retry count, so the first retry is sent right away. |
|
|
135
138
|
| `max_retry_delay` | `Float` | `8.0` | Upper bound, in seconds, on the delay between retries. |
|
|
136
139
|
|
|
137
140
|
<br />
|
|
@@ -140,7 +143,7 @@ client = ScalarGalaxy::Client.new(
|
|
|
140
143
|
|
|
141
144
|
| Option | Type | Default | Description |
|
|
142
145
|
| --- | --- | --- | --- |
|
|
143
|
-
| `idempotency_key` | `String` | - | Idempotency key for one request
|
|
146
|
+
| `idempotency_key` | `String` | - | Idempotency key for one request. This SDK configures no idempotency header, so it is not sent. |
|
|
144
147
|
| `extra_query` | `Hash` | - | Additional query parameters for one request. |
|
|
145
148
|
| `extra_headers` | `Hash` | - | Additional headers for one request. |
|
|
146
149
|
| `extra_body` | `Hash` | - | Additional body fields for one request. |
|
|
@@ -155,6 +158,24 @@ Generated clients support request timeouts and retry temporary failures such as
|
|
|
155
158
|
|
|
156
159
|
<br />
|
|
157
160
|
|
|
161
|
+
## Webhooks
|
|
162
|
+
|
|
163
|
+
The webhook helper verifies the signature of each delivery your server receives, then decodes its body into a typed event. Pass it the request body exactly as it arrived, before any JSON parsing, together with the request headers: the signature covers the raw body, so one that was parsed and re-serialized fails verification. A delivery whose signature does not verify is rejected before it is decoded.
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
# `payload` is the raw request body; `headers` holds the request headers.
|
|
167
|
+
event = client.webhooks.unwrap(payload, headers: headers)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The signing secret comes from the client's `webhook_secret` option, which defaults to the `SCALAR_WEBHOOK_SECRET` environment variable. Pass `key:` to use a different secret for one call.
|
|
171
|
+
|
|
172
|
+
The same resource also has:
|
|
173
|
+
|
|
174
|
+
- `client.webhooks.verify_signature(payload: payload, headers: headers)` checks a delivery's signature, and fails when it does not verify.
|
|
175
|
+
- `client.webhooks.parse_unsafe(payload)` decodes a body into a typed event without checking its signature. Use it only for a body verified elsewhere, or in tests.
|
|
176
|
+
|
|
177
|
+
<br />
|
|
178
|
+
|
|
158
179
|
## Helpers
|
|
159
180
|
|
|
160
181
|
- Every model is a `BaseModel`: pass a plain hash or a model instance, and read decoded values back as attributes.
|
data/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ Generated Ruby client for Scalar Galaxy API, published as `galaxy-ruby`. Use the
|
|
|
12
12
|
Add the gem to your application's `Gemfile`:
|
|
13
13
|
|
|
14
14
|
```ruby
|
|
15
|
-
gem "galaxy-ruby", "~> 0.
|
|
15
|
+
gem "galaxy-ruby", "~> 0.6.0" # x-release-please-version
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Or install it directly:
|
|
@@ -51,7 +51,7 @@ client = ScalarGalaxy::Client.new(
|
|
|
51
51
|
bearer_auth: ENV["BEARER_AUTH"], # defaults to the BEARER_AUTH env var
|
|
52
52
|
)
|
|
53
53
|
|
|
54
|
-
response = client.planets.
|
|
54
|
+
response = client.planets.list({ limit: 10, offset: 0 })
|
|
55
55
|
|
|
56
56
|
puts response.inspect
|
|
57
57
|
```
|
|
@@ -64,11 +64,13 @@ Non-success responses throw generated API errors. Error objects expose status, h
|
|
|
64
64
|
|
|
65
65
|
```ruby
|
|
66
66
|
begin
|
|
67
|
-
response = client.planets.
|
|
67
|
+
response = client.planets.list({ limit: 10, offset: 0 })
|
|
68
68
|
|
|
69
69
|
puts response.inspect
|
|
70
70
|
rescue ScalarGalaxy::Errors::APIError => error
|
|
71
71
|
puts "#{error.status}: #{error.message}"
|
|
72
|
+
puts error.request_id if error.request_id
|
|
73
|
+
puts error.problem_details if error.problem_details
|
|
72
74
|
raise
|
|
73
75
|
end
|
|
74
76
|
```
|
|
@@ -79,5 +81,5 @@ end
|
|
|
79
81
|
|
|
80
82
|
## Reference files
|
|
81
83
|
|
|
82
|
-
- [README.md](./README.md) — full feature tour: client options, request options, retries and timeouts.
|
|
84
|
+
- [README.md](./README.md) — full feature tour: client options, request options, retries and timeouts, webhooks.
|
|
83
85
|
- [api.md](./api.md) — complete catalogue of every operation with request and response types.
|
data/api.md
CHANGED
|
@@ -38,11 +38,11 @@ It's easy to say you know them all, but do you really? Retrieve all the planets
|
|
|
38
38
|
|
|
39
39
|
| Direction | Type |
|
|
40
40
|
| --- | --- |
|
|
41
|
-
| Request | [`
|
|
42
|
-
| Response | [`
|
|
41
|
+
| Request | [`PlanetListParams`](././lib/galaxy-ruby/models/planet_list_params.rb) |
|
|
42
|
+
| Response | [`PlanetListResponse`](././lib/galaxy-ruby/models/planet_list_response.rb) |
|
|
43
43
|
|
|
44
44
|
```ruby
|
|
45
|
-
response = client.planets.
|
|
45
|
+
response = client.planets.list({ limit: 10, offset: 0 })
|
|
46
46
|
|
|
47
47
|
puts response.inspect
|
|
48
48
|
```
|
|
@@ -57,7 +57,7 @@ Time to play god and create a new planet. What do you think? Ah, don't think too
|
|
|
57
57
|
| Response | [`Planet`](././lib/galaxy-ruby/models/planet.rb) |
|
|
58
58
|
|
|
59
59
|
```ruby
|
|
60
|
-
response = client.planets.create({
|
|
60
|
+
response = client.planets.create({ name: "Mars", atmosphere: [{ }], creator: { }, description: "The red planet", discovered_at: "1610-01-07T00:00:00Z", failure_callback_url: "https://example.com/webhook", habitability_index: 0.68, image: "https://cdn.scalar.com/photos/mars.jpg", physical_properties: { }, satellites: [{ "name" => "Phobos" }], success_callback_url: "https://example.com/webhook", tags: [""], type: "terrestrial" })
|
|
61
61
|
|
|
62
62
|
puts response.inspect
|
|
63
63
|
```
|
|
@@ -87,7 +87,7 @@ Sometimes you make mistakes, that's fine. No worries, you can update all planets
|
|
|
87
87
|
| Response | [`Planet`](././lib/galaxy-ruby/models/planet.rb) |
|
|
88
88
|
|
|
89
89
|
```ruby
|
|
90
|
-
response = client.planets.update(1, {
|
|
90
|
+
response = client.planets.update(1, { name: "Mars", atmosphere: [{ }], creator: { }, description: "The red planet", discovered_at: "1610-01-07T00:00:00Z", failure_callback_url: "https://example.com/webhook", habitability_index: 0.68, image: "https://cdn.scalar.com/photos/mars.jpg", physical_properties: { }, satellites: [{ "name" => "Phobos" }], success_callback_url: "https://example.com/webhook", tags: [""], type: "terrestrial" })
|
|
91
91
|
|
|
92
92
|
puts response.inspect
|
|
93
93
|
```
|
|
@@ -110,11 +110,11 @@ Got a crazy good photo of a planet? Share it with the world!
|
|
|
110
110
|
|
|
111
111
|
| Direction | Type |
|
|
112
112
|
| --- | --- |
|
|
113
|
-
| Request | [`
|
|
114
|
-
| Response | [`
|
|
113
|
+
| Request | [`PlanetUploadImageParams`](././lib/galaxy-ruby/models/planet_upload_image_params.rb) |
|
|
114
|
+
| Response | [`PlanetUploadImageResponse`](././lib/galaxy-ruby/models/planet_upload_image_response.rb) |
|
|
115
115
|
|
|
116
116
|
```ruby
|
|
117
|
-
response = client.planets.
|
|
117
|
+
response = client.planets.upload_image(1, { image: "@mars.jpg" })
|
|
118
118
|
|
|
119
119
|
puts response.inspect
|
|
120
120
|
```
|
data/lib/galaxy-ruby/client.rb
CHANGED
|
@@ -21,17 +21,17 @@ module ScalarGalaxy
|
|
|
21
21
|
# rubocop:enable Style/MutableConstant
|
|
22
22
|
|
|
23
23
|
# JWT Bearer token authentication
|
|
24
|
-
# @return [String]
|
|
24
|
+
# @return [String, nil]
|
|
25
25
|
attr_reader :bearer_auth
|
|
26
26
|
|
|
27
|
-
# @return [String]
|
|
27
|
+
# @return [String, nil]
|
|
28
28
|
attr_reader :basic_auth_username
|
|
29
29
|
|
|
30
|
-
# @return [String]
|
|
30
|
+
# @return [String, nil]
|
|
31
31
|
attr_reader :basic_auth_password
|
|
32
32
|
|
|
33
33
|
# API key request header
|
|
34
|
-
# @return [String]
|
|
34
|
+
# @return [String, nil]
|
|
35
35
|
attr_reader :api_key_header
|
|
36
36
|
|
|
37
37
|
# API key query parameter
|
|
@@ -39,7 +39,7 @@ module ScalarGalaxy
|
|
|
39
39
|
attr_reader :api_key_query
|
|
40
40
|
|
|
41
41
|
# API key browser cookie
|
|
42
|
-
# @return [String]
|
|
42
|
+
# @return [String, nil]
|
|
43
43
|
attr_reader :api_key_cookie
|
|
44
44
|
|
|
45
45
|
# OAuth 2.0 authentication
|
|
@@ -54,6 +54,15 @@ module ScalarGalaxy
|
|
|
54
54
|
# @return [String, nil]
|
|
55
55
|
attr_reader :webhook_secret
|
|
56
56
|
|
|
57
|
+
# @api private
|
|
58
|
+
#
|
|
59
|
+
# The `webhook_secret` passed to the constructor, or `nil` when it was left to
|
|
60
|
+
# default to `ENV["SCALAR_WEBHOOK_SECRET"]`. The webhook helpers read that
|
|
61
|
+
# variable again on every call, so only a value passed here outranks it.
|
|
62
|
+
#
|
|
63
|
+
# @return [String, nil]
|
|
64
|
+
attr_reader :explicit_webhook_secret
|
|
65
|
+
|
|
57
66
|
# Everything about planets
|
|
58
67
|
# @return [ScalarGalaxy::Resources::Planets]
|
|
59
68
|
attr_reader :planets
|
|
@@ -88,6 +97,8 @@ module ScalarGalaxy
|
|
|
88
97
|
#
|
|
89
98
|
# @return [Hash{String=>String}]
|
|
90
99
|
private def auth_bearer_auth
|
|
100
|
+
return {} if @bearer_auth.to_s.empty?
|
|
101
|
+
|
|
91
102
|
{"authorization" => "Bearer #{@bearer_auth}"}
|
|
92
103
|
end
|
|
93
104
|
|
|
@@ -121,6 +132,8 @@ module ScalarGalaxy
|
|
|
121
132
|
#
|
|
122
133
|
# @return [Hash{String=>String}]
|
|
123
134
|
private def auth_o_auth2
|
|
135
|
+
return {} if @o_auth2.to_s.empty?
|
|
136
|
+
|
|
124
137
|
{"authorization" => "Bearer #{@o_auth2}"}
|
|
125
138
|
end
|
|
126
139
|
|
|
@@ -128,9 +141,28 @@ module ScalarGalaxy
|
|
|
128
141
|
#
|
|
129
142
|
# @return [Hash{String=>String}]
|
|
130
143
|
private def auth_open_id_connect
|
|
144
|
+
return {} if @open_id_connect.to_s.empty?
|
|
145
|
+
|
|
131
146
|
{"authorization" => "Bearer #{@open_id_connect}"}
|
|
132
147
|
end
|
|
133
148
|
|
|
149
|
+
# @api private
|
|
150
|
+
#
|
|
151
|
+
# @return [Array<String>]
|
|
152
|
+
private def auth_header_keys = %w[authorization x-api-key cookie]
|
|
153
|
+
|
|
154
|
+
# @api private
|
|
155
|
+
#
|
|
156
|
+
# @return [Hash{String=>String}]
|
|
157
|
+
private def auth_query
|
|
158
|
+
{"api_key" => @api_key_query}.reject { |_, value| value.to_s.empty? }
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# @api private
|
|
162
|
+
#
|
|
163
|
+
# @return [Array<String>]
|
|
164
|
+
private def auth_query_keys = ["api_key"]
|
|
165
|
+
|
|
134
166
|
# Creates and returns a new client for interacting with the API.
|
|
135
167
|
#
|
|
136
168
|
# @param bearer_auth [String, nil] JWT Bearer token authentication Defaults to `ENV["BEARER_AUTH"]`
|
|
@@ -178,7 +210,7 @@ module ScalarGalaxy
|
|
|
178
210
|
api_key_cookie: ENV["API_KEY_COOKIE"],
|
|
179
211
|
o_auth2: ENV["SCALAR_O_AUTH2"],
|
|
180
212
|
open_id_connect: ENV["SCALAR_OPEN_ID_CONNECT"],
|
|
181
|
-
webhook_secret: ENV["SCALAR_WEBHOOK_SECRET"],
|
|
213
|
+
webhook_secret: (webhook_secret_from_env = ENV["SCALAR_WEBHOOK_SECRET"]),
|
|
182
214
|
environment: nil,
|
|
183
215
|
base_url: ENV["SCALAR_BASE_URL"],
|
|
184
216
|
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
|
@@ -186,55 +218,34 @@ module ScalarGalaxy
|
|
|
186
218
|
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
|
187
219
|
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
|
188
220
|
)
|
|
189
|
-
base_url ||=
|
|
190
|
-
ScalarGalaxy::Client::ENVIRONMENTS.
|
|
191
|
-
|
|
192
|
-
"environment must be one of #{ScalarGalaxy::Client::ENVIRONMENTS.keys}, got #{environment}"
|
|
193
|
-
raise ArgumentError.new(message)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
if bearer_auth.nil?
|
|
197
|
-
raise ArgumentError.new("bearer_auth is required, and can be set via environ: \"BEARER_AUTH\"")
|
|
198
|
-
end
|
|
199
|
-
if basic_auth_username.nil?
|
|
200
|
-
raise ArgumentError.new(
|
|
201
|
-
"basic_auth_username is required, and can be set via environ: \"BASIC_AUTH_USERNAME\""
|
|
202
|
-
)
|
|
203
|
-
end
|
|
204
|
-
if basic_auth_password.nil?
|
|
205
|
-
raise ArgumentError.new(
|
|
206
|
-
"basic_auth_password is required, and can be set via environ: \"BASIC_AUTH_PASSWORD\""
|
|
207
|
-
)
|
|
208
|
-
end
|
|
209
|
-
if api_key_header.nil?
|
|
210
|
-
raise ArgumentError.new("api_key_header is required, and can be set via environ: \"API_KEY_HEADER\"")
|
|
211
|
-
end
|
|
212
|
-
if api_key_cookie.nil?
|
|
213
|
-
raise ArgumentError.new("api_key_cookie is required, and can be set via environ: \"API_KEY_COOKIE\"")
|
|
221
|
+
base_url ||= ScalarGalaxy::Client::ENVIRONMENTS.fetch(environment&.to_sym || :production) do
|
|
222
|
+
message = "environment must be one of #{ScalarGalaxy::Client::ENVIRONMENTS.keys}, got #{environment}"
|
|
223
|
+
raise ArgumentError.new(message)
|
|
214
224
|
end
|
|
215
225
|
|
|
216
226
|
headers = {}
|
|
217
227
|
custom_headers_env = ENV["SCALAR_CUSTOM_HEADERS"]
|
|
218
228
|
unless custom_headers_env.nil?
|
|
219
229
|
parsed = {}
|
|
220
|
-
custom_headers_env
|
|
221
|
-
.
|
|
222
|
-
.
|
|
223
|
-
colon = line
|
|
224
|
-
parsed[line[0...colon].strip] = line[(colon + 1)..].strip unless colon.nil?
|
|
230
|
+
custom_headers_env.split("\n").each do |line|
|
|
231
|
+
colon = line.index(":")
|
|
232
|
+
unless colon.nil?
|
|
233
|
+
parsed[line[0...colon].strip] = line[(colon + 1)..].strip
|
|
225
234
|
end
|
|
235
|
+
end
|
|
226
236
|
headers = parsed.merge(headers)
|
|
227
237
|
end
|
|
228
238
|
|
|
229
|
-
@bearer_auth = bearer_auth
|
|
230
|
-
@basic_auth_username = basic_auth_username
|
|
231
|
-
@basic_auth_password = basic_auth_password
|
|
232
|
-
@api_key_header = api_key_header
|
|
239
|
+
@bearer_auth = bearer_auth&.to_s
|
|
240
|
+
@basic_auth_username = basic_auth_username&.to_s
|
|
241
|
+
@basic_auth_password = basic_auth_password&.to_s
|
|
242
|
+
@api_key_header = api_key_header&.to_s
|
|
233
243
|
@api_key_query = api_key_query&.to_s
|
|
234
|
-
@api_key_cookie = api_key_cookie
|
|
244
|
+
@api_key_cookie = api_key_cookie&.to_s
|
|
235
245
|
@o_auth2 = o_auth2&.to_s
|
|
236
246
|
@open_id_connect = open_id_connect&.to_s
|
|
237
247
|
@webhook_secret = webhook_secret&.to_s
|
|
248
|
+
@explicit_webhook_secret = webhook_secret_from_env.nil? ? @webhook_secret : nil
|
|
238
249
|
|
|
239
250
|
super(
|
|
240
251
|
base_url: base_url,
|
data/lib/galaxy-ruby/errors.rb
CHANGED
|
@@ -46,6 +46,28 @@ module ScalarGalaxy
|
|
|
46
46
|
# @return [Object, nil]
|
|
47
47
|
attr_accessor :body
|
|
48
48
|
|
|
49
|
+
# Request identifier exposed by common API response headers, matched case-insensitively.
|
|
50
|
+
# @return [String, nil]
|
|
51
|
+
def request_id
|
|
52
|
+
response_header("x-request-id") || response_header("request-id") ||
|
|
53
|
+
response_header("x-correlation-id")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Parsed RFC 7807 body for application/problem+json responses, preserving extension fields.
|
|
57
|
+
# Non-object bodies and other media types are not treated as Problem Details.
|
|
58
|
+
# @return [Hash{String, Symbol=>Object}, nil]
|
|
59
|
+
def problem_details
|
|
60
|
+
media_type = response_header("content-type").to_s.split(";", 2).first.to_s.strip.downcase
|
|
61
|
+
@body if media_type == "application/problem+json" && @body.is_a?(Hash)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Header maps supplied directly by callers need not use the transport's lowercase spelling.
|
|
65
|
+
# @param name [String]
|
|
66
|
+
# @return [String, nil]
|
|
67
|
+
private def response_header(name)
|
|
68
|
+
@headers&.find { |key, _| key.to_s.downcase == name }&.last
|
|
69
|
+
end
|
|
70
|
+
|
|
49
71
|
# @api private
|
|
50
72
|
#
|
|
51
73
|
# @param url [URI::Generic]
|
|
@@ -223,5 +245,23 @@ module ScalarGalaxy
|
|
|
223
245
|
class InternalServerError < ScalarGalaxy::Errors::APIStatusError
|
|
224
246
|
HTTP_STATUS = (500..)
|
|
225
247
|
end
|
|
248
|
+
|
|
249
|
+
# Raised by SDKs that verify webhook signatures through the `standardwebhooks` gem when that gem
|
|
250
|
+
# is not installed. This SDK verifies them with the standard library and never raises it; the
|
|
251
|
+
# class is declared so code that rescues or names it keeps working.
|
|
252
|
+
class MissingDependencyError < ScalarGalaxy::Errors::Error
|
|
253
|
+
# @api private
|
|
254
|
+
#
|
|
255
|
+
# @param gem_name [String]
|
|
256
|
+
# @param feature [String]
|
|
257
|
+
def initialize(gem_name:, feature:)
|
|
258
|
+
message = [
|
|
259
|
+
"The '#{gem_name}' gem is required to use #{feature}.",
|
|
260
|
+
"Install it with: gem install #{gem_name}",
|
|
261
|
+
"Or add it to your Gemfile: gem '#{gem_name}'"
|
|
262
|
+
].join("\n")
|
|
263
|
+
super(message)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
226
266
|
end
|
|
227
267
|
end
|
|
@@ -37,10 +37,22 @@ module ScalarGalaxy
|
|
|
37
37
|
# @return [String]
|
|
38
38
|
def to_yaml(*a) = read.to_yaml(*a)
|
|
39
39
|
|
|
40
|
+
# The filename sent for a part is only ever a basename: an open `File` knows the full local path
|
|
41
|
+
# it was opened from, which is the caller's business and not the server's.
|
|
42
|
+
#
|
|
43
|
+
# The content type is written into the part's headers as given, so one carrying a control
|
|
44
|
+
# character (a CR or LF would start a header line of its own) is refused here, before any request.
|
|
45
|
+
#
|
|
40
46
|
# @param content [Pathname, StringIO, IO, String]
|
|
41
47
|
# @param filename [Pathname, String, nil]
|
|
42
48
|
# @param content_type [String, nil]
|
|
49
|
+
#
|
|
50
|
+
# @raise [ArgumentError] when `content_type` contains a control character
|
|
43
51
|
def initialize(content, filename: nil, content_type: nil)
|
|
52
|
+
if content_type&.to_s&.match?(/[\x00-\x1F\x7F]/)
|
|
53
|
+
raise ArgumentError.new("The content type #{content_type.inspect} contains a control character.")
|
|
54
|
+
end
|
|
55
|
+
|
|
44
56
|
@content_type = content_type
|
|
45
57
|
@filename =
|
|
46
58
|
case [filename, (@content = content)]
|
|
@@ -49,7 +61,7 @@ module ScalarGalaxy
|
|
|
49
61
|
in [nil, Pathname]
|
|
50
62
|
content.basename.to_path
|
|
51
63
|
in [nil, IO]
|
|
52
|
-
content.to_path
|
|
64
|
+
content.respond_to?(:to_path) ? ::File.basename(content.to_path) : nil
|
|
53
65
|
else
|
|
54
66
|
filename
|
|
55
67
|
end
|