w3c_api 0.1.4 → 0.1.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -1
- data/.rubocop_todo.yml +20 -38
- data/README.adoc +51 -0
- data/Rakefile +3 -3
- data/demo/rate_limiting_demo.rb +135 -0
- data/demo/test_embed_functionality.rb +31 -30
- data/demo/test_improved_embed_functionality.rb +92 -0
- data/examples/rate_limiting_stress_test.rb +239 -0
- data/exe/w3c_api +1 -1
- data/lib/w3c_api/cli.rb +29 -28
- data/lib/w3c_api/client.rb +8 -7
- data/lib/w3c_api/commands/affiliation.rb +15 -12
- data/lib/w3c_api/commands/ecosystem.rb +22 -15
- data/lib/w3c_api/commands/group.rb +32 -25
- data/lib/w3c_api/commands/output_formatter.rb +1 -1
- data/lib/w3c_api/commands/participation.rb +11 -9
- data/lib/w3c_api/commands/series.rb +11 -9
- data/lib/w3c_api/commands/specification.rb +59 -45
- data/lib/w3c_api/commands/specification_version.rb +21 -12
- data/lib/w3c_api/commands/translation.rb +7 -6
- data/lib/w3c_api/commands/user.rb +36 -24
- data/lib/w3c_api/embed.rb +7 -7
- data/lib/w3c_api/hal.rb +168 -133
- data/lib/w3c_api/models/account.rb +3 -3
- data/lib/w3c_api/models/affiliation.rb +8 -7
- data/lib/w3c_api/models/affiliation_index.rb +3 -2
- data/lib/w3c_api/models/call_for_translation.rb +4 -3
- data/lib/w3c_api/models/chair_index.rb +2 -2
- data/lib/w3c_api/models/charter.rb +5 -5
- data/lib/w3c_api/models/charter_index.rb +3 -2
- data/lib/w3c_api/models/connected_account.rb +2 -2
- data/lib/w3c_api/models/deliverer_index.rb +3 -2
- data/lib/w3c_api/models/ecosystem.rb +8 -6
- data/lib/w3c_api/models/ecosystem_index.rb +3 -2
- data/lib/w3c_api/models/editor_index.rb +2 -2
- data/lib/w3c_api/models/evangelist_index.rb +3 -2
- data/lib/w3c_api/models/group.rb +16 -13
- data/lib/w3c_api/models/group_index.rb +2 -2
- data/lib/w3c_api/models/groups.rb +2 -2
- data/lib/w3c_api/models/participant_index.rb +3 -2
- data/lib/w3c_api/models/participation.rb +6 -5
- data/lib/w3c_api/models/participation_index.rb +3 -2
- data/lib/w3c_api/models/photo.rb +1 -1
- data/lib/w3c_api/models/serie.rb +6 -4
- data/lib/w3c_api/models/serie_index.rb +3 -2
- data/lib/w3c_api/models/spec_version.rb +10 -7
- data/lib/w3c_api/models/spec_version_index.rb +3 -2
- data/lib/w3c_api/models/spec_version_predecessor_index.rb +3 -2
- data/lib/w3c_api/models/spec_version_successor_index.rb +3 -2
- data/lib/w3c_api/models/specification.rb +17 -9
- data/lib/w3c_api/models/specification_index.rb +3 -2
- data/lib/w3c_api/models/team_contact_index.rb +3 -2
- data/lib/w3c_api/models/testimonial.rb +2 -2
- data/lib/w3c_api/models/translation.rb +4 -4
- data/lib/w3c_api/models/translation_index.rb +3 -2
- data/lib/w3c_api/models/user.rb +16 -11
- data/lib/w3c_api/models/user_index.rb +2 -2
- data/lib/w3c_api/models.rb +52 -37
- data/lib/w3c_api/version.rb +1 -1
- data/lib/w3c_api.rb +8 -8
- metadata +8 -5
data/lib/w3c_api/hal.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require_relative
|
3
|
+
require "singleton"
|
4
|
+
require "lutaml/hal"
|
5
|
+
require_relative "models"
|
6
6
|
|
7
7
|
module W3cApi
|
8
8
|
# Simple parameter class to satisfy lutaml-hal validation requirements
|
@@ -18,7 +18,10 @@ module W3cApi
|
|
18
18
|
|
19
19
|
def validate!
|
20
20
|
# Simple validation - just ensure name is present
|
21
|
-
|
21
|
+
if @name.nil? || @name.empty?
|
22
|
+
raise ArgumentError,
|
23
|
+
"Parameter name cannot be empty"
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
def path_parameter?
|
@@ -38,14 +41,45 @@ module W3cApi
|
|
38
41
|
class Hal
|
39
42
|
include Singleton
|
40
43
|
|
41
|
-
API_URL =
|
44
|
+
API_URL = "https://api.w3.org/"
|
42
45
|
|
43
46
|
def initialize
|
44
47
|
# Don't call setup here - it will be called when register is first accessed
|
45
48
|
end
|
46
49
|
|
47
50
|
def client
|
48
|
-
@client ||= Lutaml::Hal::Client.new(
|
51
|
+
@client ||= Lutaml::Hal::Client.new(
|
52
|
+
api_url: API_URL,
|
53
|
+
rate_limiting: rate_limiting_options,
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Configure rate limiting options
|
58
|
+
def rate_limiting_options
|
59
|
+
@rate_limiting_options ||= {
|
60
|
+
enabled: true,
|
61
|
+
max_retries: 3,
|
62
|
+
base_delay: 1.0,
|
63
|
+
max_delay: 60.0,
|
64
|
+
backoff_factor: 2.0,
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Set rate limiting options
|
69
|
+
def configure_rate_limiting(options = {})
|
70
|
+
@rate_limiting_options = rate_limiting_options.merge(options)
|
71
|
+
# Reset client to pick up new options
|
72
|
+
@client = nil
|
73
|
+
end
|
74
|
+
|
75
|
+
# Disable rate limiting
|
76
|
+
def disable_rate_limiting
|
77
|
+
configure_rate_limiting(enabled: false)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Enable rate limiting
|
81
|
+
def enable_rate_limiting
|
82
|
+
configure_rate_limiting(enabled: true)
|
49
83
|
end
|
50
84
|
|
51
85
|
def register
|
@@ -69,15 +103,15 @@ module W3cApi
|
|
69
103
|
# Common pagination parameters (simplified without EndpointParameter)
|
70
104
|
def pagination_parameters
|
71
105
|
[
|
72
|
-
SimpleParameter.new(
|
73
|
-
SimpleParameter.new(
|
106
|
+
SimpleParameter.new("page", location: :query),
|
107
|
+
SimpleParameter.new("items", location: :query),
|
74
108
|
]
|
75
109
|
end
|
76
110
|
|
77
111
|
# Parameters for endpoints with embed support (simplified without EndpointParameter)
|
78
112
|
def embed_parameters
|
79
113
|
[
|
80
|
-
SimpleParameter.new(
|
114
|
+
SimpleParameter.new("embed", location: :query),
|
81
115
|
] + pagination_parameters
|
82
116
|
end
|
83
117
|
|
@@ -101,7 +135,7 @@ module W3cApi
|
|
101
135
|
type: :index,
|
102
136
|
url: url,
|
103
137
|
model: model,
|
104
|
-
parameters: parameters
|
138
|
+
parameters: parameters,
|
105
139
|
)
|
106
140
|
end
|
107
141
|
|
@@ -112,19 +146,20 @@ module W3cApi
|
|
112
146
|
type: :resource,
|
113
147
|
url: url,
|
114
148
|
model: model,
|
115
|
-
parameters: parameters
|
149
|
+
parameters: parameters,
|
116
150
|
)
|
117
151
|
end
|
118
152
|
|
119
153
|
# Helper method to add endpoints with path parameters
|
120
|
-
def add_endpoint_with_path_params(id, type, url, model, path_params = [],
|
154
|
+
def add_endpoint_with_path_params(id, type, url, model, path_params = [],
|
155
|
+
query_params = [])
|
121
156
|
parameters = (path_params + query_params).compact
|
122
157
|
register.add_endpoint(
|
123
158
|
id: id,
|
124
159
|
type: type,
|
125
160
|
url: url,
|
126
161
|
model: model,
|
127
|
-
parameters: parameters
|
162
|
+
parameters: parameters,
|
128
163
|
)
|
129
164
|
end
|
130
165
|
|
@@ -132,94 +167,94 @@ module W3cApi
|
|
132
167
|
# Specification endpoints with embed support
|
133
168
|
add_index_endpoint(
|
134
169
|
:specification_index,
|
135
|
-
|
170
|
+
"/specifications",
|
136
171
|
Models::SpecificationIndex,
|
137
|
-
embed_parameters
|
172
|
+
embed_parameters,
|
138
173
|
)
|
139
174
|
|
140
175
|
# Specification by status endpoint
|
141
176
|
add_endpoint_with_path_params(
|
142
177
|
:specification_by_status_index,
|
143
178
|
:index,
|
144
|
-
|
179
|
+
"/specifications",
|
145
180
|
Models::SpecificationIndex,
|
146
181
|
[],
|
147
|
-
[string_query_param(
|
182
|
+
[string_query_param("status", required: true)] + pagination_parameters,
|
148
183
|
)
|
149
184
|
add_endpoint_with_path_params(
|
150
185
|
:specification_resource,
|
151
186
|
:resource,
|
152
|
-
|
187
|
+
"/specifications/{shortname}",
|
153
188
|
Models::Specification,
|
154
|
-
[string_path_param(
|
189
|
+
[string_path_param("shortname")],
|
155
190
|
)
|
156
191
|
|
157
192
|
# Specification version endpoints
|
158
193
|
add_endpoint_with_path_params(
|
159
194
|
:specification_resource_version_index,
|
160
195
|
:index,
|
161
|
-
|
196
|
+
"/specifications/{shortname}/versions",
|
162
197
|
Models::SpecVersionIndex,
|
163
|
-
[string_path_param(
|
164
|
-
pagination_parameters
|
198
|
+
[string_path_param("shortname")],
|
199
|
+
pagination_parameters,
|
165
200
|
)
|
166
201
|
add_endpoint_with_path_params(
|
167
202
|
:specification_resource_version_resource,
|
168
203
|
:resource,
|
169
|
-
|
204
|
+
"/specifications/{shortname}/versions/{version}",
|
170
205
|
Models::SpecVersion,
|
171
206
|
[
|
172
|
-
string_path_param(
|
173
|
-
string_path_param(
|
174
|
-
]
|
207
|
+
string_path_param("shortname"),
|
208
|
+
string_path_param("version"),
|
209
|
+
],
|
175
210
|
)
|
176
211
|
|
177
212
|
# Specification version editors and deliverers
|
178
213
|
add_endpoint_with_path_params(
|
179
214
|
:specification_version_editors_index,
|
180
215
|
:index,
|
181
|
-
|
216
|
+
"/specifications/{shortname}/versions/{version}/editors",
|
182
217
|
Models::EditorIndex,
|
183
218
|
[
|
184
|
-
string_path_param(
|
185
|
-
string_path_param(
|
219
|
+
string_path_param("shortname"),
|
220
|
+
string_path_param("version"),
|
186
221
|
],
|
187
|
-
pagination_parameters
|
222
|
+
pagination_parameters,
|
188
223
|
)
|
189
224
|
add_endpoint_with_path_params(
|
190
225
|
:specification_version_deliverers_index,
|
191
226
|
:index,
|
192
|
-
|
227
|
+
"/specifications/{shortname}/versions/{version}/deliverers",
|
193
228
|
Models::DelivererIndex,
|
194
229
|
[
|
195
|
-
string_path_param(
|
196
|
-
string_path_param(
|
230
|
+
string_path_param("shortname"),
|
231
|
+
string_path_param("version"),
|
197
232
|
],
|
198
|
-
pagination_parameters
|
233
|
+
pagination_parameters,
|
199
234
|
)
|
200
235
|
|
201
236
|
# Specification version predecessors and successors
|
202
237
|
add_endpoint_with_path_params(
|
203
238
|
:specification_version_predecessors_index,
|
204
239
|
:index,
|
205
|
-
|
240
|
+
"/specifications/{shortname}/versions/{version}/predecessors",
|
206
241
|
Models::SpecVersionPredecessorIndex,
|
207
242
|
[
|
208
|
-
string_path_param(
|
209
|
-
string_path_param(
|
243
|
+
string_path_param("shortname"),
|
244
|
+
string_path_param("version"),
|
210
245
|
],
|
211
|
-
pagination_parameters
|
246
|
+
pagination_parameters,
|
212
247
|
)
|
213
248
|
add_endpoint_with_path_params(
|
214
249
|
:specification_version_successors_index,
|
215
250
|
:index,
|
216
|
-
|
251
|
+
"/specifications/{shortname}/versions/{version}/successors",
|
217
252
|
Models::SpecVersionSuccessorIndex,
|
218
253
|
[
|
219
|
-
string_path_param(
|
220
|
-
string_path_param(
|
254
|
+
string_path_param("shortname"),
|
255
|
+
string_path_param("version"),
|
221
256
|
],
|
222
|
-
pagination_parameters
|
257
|
+
pagination_parameters,
|
223
258
|
)
|
224
259
|
|
225
260
|
# Specification related endpoints
|
@@ -228,9 +263,9 @@ module W3cApi
|
|
228
263
|
:"specification_#{relation}_index",
|
229
264
|
:index,
|
230
265
|
"/specifications/{shortname}/#{relation.tr('_', '-')}",
|
231
|
-
relation.include?(
|
232
|
-
[string_path_param(
|
233
|
-
pagination_parameters
|
266
|
+
relation.include?("editor") ? Models::UserIndex : Models::GroupIndex,
|
267
|
+
[string_path_param("shortname")],
|
268
|
+
pagination_parameters,
|
234
269
|
)
|
235
270
|
end
|
236
271
|
|
@@ -245,120 +280,120 @@ module W3cApi
|
|
245
280
|
# Series endpoints with embed support
|
246
281
|
add_index_endpoint(
|
247
282
|
:serie_index,
|
248
|
-
|
283
|
+
"/specification-series",
|
249
284
|
Models::SerieIndex,
|
250
|
-
embed_parameters
|
285
|
+
embed_parameters,
|
251
286
|
)
|
252
287
|
add_endpoint_with_path_params(
|
253
288
|
:serie_resource,
|
254
289
|
:resource,
|
255
|
-
|
290
|
+
"/specification-series/{shortname}",
|
256
291
|
Models::Serie,
|
257
|
-
[string_path_param(
|
292
|
+
[string_path_param("shortname")],
|
258
293
|
)
|
259
294
|
add_endpoint_with_path_params(
|
260
295
|
:serie_specification_resource,
|
261
296
|
:index,
|
262
|
-
|
297
|
+
"/specification-series/{shortname}/specifications",
|
263
298
|
Models::SpecificationIndex,
|
264
|
-
[string_path_param(
|
265
|
-
pagination_parameters
|
299
|
+
[string_path_param("shortname")],
|
300
|
+
pagination_parameters,
|
266
301
|
)
|
267
302
|
|
268
303
|
# Group endpoints with embed support
|
269
304
|
add_index_endpoint(
|
270
305
|
:group_index,
|
271
|
-
|
306
|
+
"/groups",
|
272
307
|
Models::GroupIndex,
|
273
|
-
embed_parameters
|
308
|
+
embed_parameters,
|
274
309
|
)
|
275
310
|
add_endpoint_with_path_params(
|
276
311
|
:group_resource,
|
277
312
|
:resource,
|
278
|
-
|
313
|
+
"/groups/{id}",
|
279
314
|
Models::Group,
|
280
|
-
[integer_path_param(
|
315
|
+
[integer_path_param("id")],
|
281
316
|
)
|
282
317
|
add_endpoint_with_path_params(
|
283
318
|
:group_by_type_shortname_resource,
|
284
319
|
:resource,
|
285
|
-
|
320
|
+
"/groups/{type}/{shortname}",
|
286
321
|
Models::Group,
|
287
322
|
[
|
288
|
-
string_path_param(
|
289
|
-
string_path_param(
|
290
|
-
]
|
323
|
+
string_path_param("type"),
|
324
|
+
string_path_param("shortname"),
|
325
|
+
],
|
291
326
|
)
|
292
327
|
add_endpoint_with_path_params(
|
293
328
|
:group_by_type_index,
|
294
329
|
:index,
|
295
|
-
|
330
|
+
"/groups/{type}",
|
296
331
|
Models::GroupIndex,
|
297
|
-
[string_path_param(
|
298
|
-
pagination_parameters
|
332
|
+
[string_path_param("type")],
|
333
|
+
pagination_parameters,
|
299
334
|
)
|
300
335
|
# Group nested endpoints
|
301
336
|
add_endpoint_with_path_params(
|
302
337
|
:group_specifications_index,
|
303
338
|
:index,
|
304
|
-
|
339
|
+
"/groups/{id}/specifications",
|
305
340
|
Models::SpecificationIndex,
|
306
|
-
[integer_path_param(
|
307
|
-
pagination_parameters
|
341
|
+
[integer_path_param("id")],
|
342
|
+
pagination_parameters,
|
308
343
|
)
|
309
344
|
add_endpoint_with_path_params(
|
310
345
|
:group_users_index,
|
311
346
|
:index,
|
312
|
-
|
347
|
+
"/groups/{id}/users",
|
313
348
|
Models::UserIndex,
|
314
|
-
[integer_path_param(
|
315
|
-
pagination_parameters
|
349
|
+
[integer_path_param("id")],
|
350
|
+
pagination_parameters,
|
316
351
|
)
|
317
352
|
add_endpoint_with_path_params(
|
318
353
|
:group_charters_index,
|
319
354
|
:index,
|
320
|
-
|
355
|
+
"/groups/{id}/charters",
|
321
356
|
Models::CharterIndex,
|
322
|
-
[integer_path_param(
|
323
|
-
pagination_parameters
|
357
|
+
[integer_path_param("id")],
|
358
|
+
pagination_parameters,
|
324
359
|
)
|
325
360
|
add_endpoint_with_path_params(
|
326
361
|
:group_chairs_index,
|
327
362
|
:index,
|
328
|
-
|
363
|
+
"/groups/{id}/chairs",
|
329
364
|
Models::ChairIndex,
|
330
|
-
[integer_path_param(
|
331
|
-
pagination_parameters
|
365
|
+
[integer_path_param("id")],
|
366
|
+
pagination_parameters,
|
332
367
|
)
|
333
368
|
add_endpoint_with_path_params(
|
334
369
|
:group_team_contacts_index,
|
335
370
|
:index,
|
336
|
-
|
371
|
+
"/groups/{id}/teamcontacts",
|
337
372
|
Models::TeamContactIndex,
|
338
|
-
[integer_path_param(
|
339
|
-
pagination_parameters
|
373
|
+
[integer_path_param("id")],
|
374
|
+
pagination_parameters,
|
340
375
|
)
|
341
376
|
add_endpoint_with_path_params(
|
342
377
|
:group_participations_index,
|
343
378
|
:index,
|
344
|
-
|
379
|
+
"/groups/{id}/participations",
|
345
380
|
Models::ParticipationIndex,
|
346
|
-
[integer_path_param(
|
347
|
-
pagination_parameters
|
381
|
+
[integer_path_param("id")],
|
382
|
+
pagination_parameters,
|
348
383
|
)
|
349
384
|
|
350
385
|
# Translation endpoints
|
351
386
|
add_index_endpoint(
|
352
387
|
:translation_index,
|
353
|
-
|
354
|
-
Models::TranslationIndex
|
388
|
+
"/translations",
|
389
|
+
Models::TranslationIndex,
|
355
390
|
)
|
356
391
|
add_endpoint_with_path_params(
|
357
392
|
:translation_resource,
|
358
393
|
:resource,
|
359
|
-
|
394
|
+
"/translations/{id}",
|
360
395
|
Models::Translation,
|
361
|
-
[integer_path_param(
|
396
|
+
[integer_path_param("id")],
|
362
397
|
)
|
363
398
|
|
364
399
|
# User endpoints
|
@@ -372,148 +407,148 @@ module W3cApi
|
|
372
407
|
add_endpoint_with_path_params(
|
373
408
|
:user_resource,
|
374
409
|
:resource,
|
375
|
-
|
410
|
+
"/users/{hash}",
|
376
411
|
Models::User,
|
377
|
-
[string_path_param(
|
412
|
+
[string_path_param("hash")],
|
378
413
|
)
|
379
414
|
|
380
415
|
# User nested endpoints
|
381
416
|
add_endpoint_with_path_params(
|
382
417
|
:user_groups_index,
|
383
418
|
:index,
|
384
|
-
|
419
|
+
"/users/{hash}/groups",
|
385
420
|
Models::GroupIndex,
|
386
|
-
[string_path_param(
|
387
|
-
pagination_parameters
|
421
|
+
[string_path_param("hash")],
|
422
|
+
pagination_parameters,
|
388
423
|
)
|
389
424
|
add_endpoint_with_path_params(
|
390
425
|
:user_affiliations_index,
|
391
426
|
:index,
|
392
|
-
|
427
|
+
"/users/{hash}/affiliations",
|
393
428
|
Models::AffiliationIndex,
|
394
|
-
[string_path_param(
|
395
|
-
pagination_parameters
|
429
|
+
[string_path_param("hash")],
|
430
|
+
pagination_parameters,
|
396
431
|
)
|
397
432
|
add_endpoint_with_path_params(
|
398
433
|
:user_participations_index,
|
399
434
|
:index,
|
400
|
-
|
435
|
+
"/users/{hash}/participations",
|
401
436
|
Models::ParticipationIndex,
|
402
|
-
[string_path_param(
|
403
|
-
pagination_parameters
|
437
|
+
[string_path_param("hash")],
|
438
|
+
pagination_parameters,
|
404
439
|
)
|
405
440
|
add_endpoint_with_path_params(
|
406
441
|
:user_chair_of_groups_index,
|
407
442
|
:index,
|
408
|
-
|
443
|
+
"/users/{hash}/chair-of-groups",
|
409
444
|
Models::GroupIndex,
|
410
|
-
[string_path_param(
|
411
|
-
pagination_parameters
|
445
|
+
[string_path_param("hash")],
|
446
|
+
pagination_parameters,
|
412
447
|
)
|
413
448
|
add_endpoint_with_path_params(
|
414
449
|
:user_team_contact_of_groups_index,
|
415
450
|
:index,
|
416
|
-
|
451
|
+
"/users/{hash}/team-contact-of-groups",
|
417
452
|
Models::GroupIndex,
|
418
|
-
[string_path_param(
|
419
|
-
pagination_parameters
|
453
|
+
[string_path_param("hash")],
|
454
|
+
pagination_parameters,
|
420
455
|
)
|
421
456
|
add_endpoint_with_path_params(
|
422
457
|
:user_specifications_index,
|
423
458
|
:index,
|
424
|
-
|
459
|
+
"/users/{hash}/specifications",
|
425
460
|
Models::SpecificationIndex,
|
426
|
-
[string_path_param(
|
427
|
-
pagination_parameters
|
461
|
+
[string_path_param("hash")],
|
462
|
+
pagination_parameters,
|
428
463
|
)
|
429
464
|
|
430
465
|
# Affiliation endpoints
|
431
466
|
add_index_endpoint(
|
432
467
|
:affiliation_index,
|
433
|
-
|
434
|
-
Models::AffiliationIndex
|
468
|
+
"/affiliations",
|
469
|
+
Models::AffiliationIndex,
|
435
470
|
)
|
436
471
|
add_endpoint_with_path_params(
|
437
472
|
:affiliation_resource,
|
438
473
|
:resource,
|
439
|
-
|
474
|
+
"/affiliations/{id}",
|
440
475
|
Models::Affiliation,
|
441
|
-
[integer_path_param(
|
476
|
+
[integer_path_param("id")],
|
442
477
|
)
|
443
478
|
|
444
479
|
# Affiliation nested endpoints
|
445
480
|
add_endpoint_with_path_params(
|
446
481
|
:affiliation_participants_index,
|
447
482
|
:index,
|
448
|
-
|
483
|
+
"/affiliations/{id}/participants",
|
449
484
|
Models::ParticipantIndex,
|
450
|
-
[integer_path_param(
|
451
|
-
pagination_parameters
|
485
|
+
[integer_path_param("id")],
|
486
|
+
pagination_parameters,
|
452
487
|
)
|
453
488
|
add_endpoint_with_path_params(
|
454
489
|
:affiliation_participations_index,
|
455
490
|
:index,
|
456
|
-
|
491
|
+
"/affiliations/{id}/participations",
|
457
492
|
Models::ParticipationIndex,
|
458
|
-
[integer_path_param(
|
459
|
-
pagination_parameters
|
493
|
+
[integer_path_param("id")],
|
494
|
+
pagination_parameters,
|
460
495
|
)
|
461
496
|
|
462
497
|
# Ecosystem endpoints
|
463
498
|
add_index_endpoint(
|
464
499
|
:ecosystem_index,
|
465
|
-
|
466
|
-
Models::EcosystemIndex
|
500
|
+
"/ecosystems",
|
501
|
+
Models::EcosystemIndex,
|
467
502
|
)
|
468
503
|
add_endpoint_with_path_params(
|
469
504
|
:ecosystem_resource,
|
470
505
|
:resource,
|
471
|
-
|
506
|
+
"/ecosystems/{shortname}",
|
472
507
|
Models::Ecosystem,
|
473
|
-
[string_path_param(
|
508
|
+
[string_path_param("shortname")],
|
474
509
|
)
|
475
510
|
|
476
511
|
# Ecosystem nested endpoints
|
477
512
|
add_endpoint_with_path_params(
|
478
513
|
:ecosystem_groups_index,
|
479
514
|
:index,
|
480
|
-
|
515
|
+
"/ecosystems/{shortname}/groups",
|
481
516
|
Models::GroupIndex,
|
482
|
-
[string_path_param(
|
483
|
-
pagination_parameters
|
517
|
+
[string_path_param("shortname")],
|
518
|
+
pagination_parameters,
|
484
519
|
)
|
485
520
|
add_endpoint_with_path_params(
|
486
521
|
:ecosystem_evangelists_index,
|
487
522
|
:index,
|
488
|
-
|
523
|
+
"/ecosystems/{shortname}/evangelists",
|
489
524
|
Models::EvangelistIndex,
|
490
|
-
[string_path_param(
|
491
|
-
pagination_parameters
|
525
|
+
[string_path_param("shortname")],
|
526
|
+
pagination_parameters,
|
492
527
|
)
|
493
528
|
add_endpoint_with_path_params(
|
494
529
|
:ecosystem_member_organizations_index,
|
495
530
|
:index,
|
496
|
-
|
531
|
+
"/ecosystems/{shortname}/member-organizations",
|
497
532
|
Models::AffiliationIndex,
|
498
|
-
[string_path_param(
|
499
|
-
pagination_parameters
|
533
|
+
[string_path_param("shortname")],
|
534
|
+
pagination_parameters,
|
500
535
|
)
|
501
536
|
|
502
537
|
# Participation endpoints
|
503
538
|
add_endpoint_with_path_params(
|
504
539
|
:participation_resource,
|
505
540
|
:resource,
|
506
|
-
|
541
|
+
"/participations/{id}",
|
507
542
|
Models::Participation,
|
508
|
-
[integer_path_param(
|
543
|
+
[integer_path_param("id")],
|
509
544
|
)
|
510
545
|
add_endpoint_with_path_params(
|
511
546
|
:participation_participants_index,
|
512
547
|
:index,
|
513
|
-
|
548
|
+
"/participations/{id}/participants",
|
514
549
|
Models::ParticipantIndex,
|
515
|
-
[integer_path_param(
|
516
|
-
pagination_parameters
|
550
|
+
[integer_path_param("id")],
|
551
|
+
pagination_parameters,
|
517
552
|
)
|
518
553
|
end
|
519
554
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "lutaml/hal"
|
4
4
|
# {
|
5
5
|
# "created": "2021-03-12T22:06:06+00:00",
|
6
6
|
# "service": "github",
|
@@ -27,7 +27,7 @@ module W3cApi
|
|
27
27
|
attribute :profile_picture, :string
|
28
28
|
attribute :href, :string
|
29
29
|
|
30
|
-
hal_link :user, key:
|
30
|
+
hal_link :user, key: "user", realize_class: "User"
|
31
31
|
|
32
32
|
key_value do
|
33
33
|
%i[
|
@@ -38,7 +38,7 @@ module W3cApi
|
|
38
38
|
service
|
39
39
|
profile_picture
|
40
40
|
].each do |key|
|
41
|
-
map key.to_s.tr(
|
41
|
+
map key.to_s.tr("_", "-"), to: key
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -36,7 +36,7 @@
|
|
36
36
|
# "title"=>"Framkom (Forskningsaktiebolaget Medie-och Kommunikationsteknik)"
|
37
37
|
# },
|
38
38
|
|
39
|
-
require_relative
|
39
|
+
require_relative "testimonial"
|
40
40
|
|
41
41
|
module W3cApi
|
42
42
|
module Models
|
@@ -51,11 +51,12 @@ module W3cApi
|
|
51
51
|
attribute :is_member_association, :boolean
|
52
52
|
attribute :is_partner_member, :boolean
|
53
53
|
|
54
|
-
hal_link :self, key:
|
55
|
-
hal_link :homepage, key:
|
56
|
-
hal_link :participants, key:
|
57
|
-
hal_link :participations, key:
|
58
|
-
|
54
|
+
hal_link :self, key: "self", realize_class: "Affiliation"
|
55
|
+
hal_link :homepage, key: "homepage", realize_class: "String"
|
56
|
+
hal_link :participants, key: "participants", realize_class: "Participant"
|
57
|
+
hal_link :participations, key: "participations",
|
58
|
+
realize_class: "Participation"
|
59
|
+
hal_link :logo, key: "logo", realize_class: "String"
|
59
60
|
|
60
61
|
key_value do
|
61
62
|
%i[
|
@@ -67,7 +68,7 @@ module W3cApi
|
|
67
68
|
is_member_association
|
68
69
|
is_partner_member
|
69
70
|
].each do |key|
|
70
|
-
map key.to_s.tr(
|
71
|
+
map key.to_s.tr("_", "-"), to: key
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|