w3c_api 0.1.1 → 0.1.3
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 +1 -0
- data/.rubocop_todo.yml +47 -0
- data/README.adoc +217 -88
- data/Rakefile +7 -3
- data/lib/w3c_api/cli.rb +4 -0
- data/lib/w3c_api/client.rb +73 -105
- data/lib/w3c_api/commands/specification_version.rb +38 -0
- data/lib/w3c_api/hal.rb +293 -112
- data/lib/w3c_api/models/account.rb +2 -0
- data/lib/w3c_api/models/affiliation.rb +12 -0
- data/lib/w3c_api/models/affiliation_index.rb +1 -0
- data/lib/w3c_api/models/deliverer_index.rb +12 -0
- data/lib/w3c_api/models/editor_index.rb +12 -0
- data/lib/w3c_api/models/group.rb +25 -1
- data/lib/w3c_api/models/groups.rb +32 -0
- data/lib/w3c_api/models/photo.rb +2 -0
- data/lib/w3c_api/models/serie.rb +12 -0
- data/lib/w3c_api/models/spec_version.rb +4 -4
- data/lib/w3c_api/models/spec_version_index.rb +0 -2
- data/lib/w3c_api/models/spec_version_predecessor_index.rb +11 -0
- data/lib/w3c_api/models/spec_version_successor_index.rb +11 -0
- data/lib/w3c_api/models/specification.rb +7 -0
- data/lib/w3c_api/models/specification_index.rb +2 -0
- data/lib/w3c_api/models/testimonial.rb +2 -0
- data/lib/w3c_api/models/translation_index.rb +3 -1
- data/lib/w3c_api/models/user.rb +12 -0
- data/lib/w3c_api/models.rb +41 -32
- data/lib/w3c_api/version.rb +1 -1
- metadata +14 -6
data/lib/w3c_api/hal.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
4
|
require_relative 'models'
|
3
5
|
|
@@ -5,126 +7,139 @@ module W3cApi
|
|
5
7
|
class Hal
|
6
8
|
include Singleton
|
7
9
|
|
10
|
+
API_URL = 'https://api.w3.org/'
|
11
|
+
|
8
12
|
def initialize
|
9
13
|
setup
|
10
14
|
end
|
11
15
|
|
12
16
|
def client
|
13
|
-
@client ||= Lutaml::Hal::Client.new(api_url:
|
17
|
+
@client ||= Lutaml::Hal::Client.new(api_url: API_URL)
|
14
18
|
end
|
15
19
|
|
16
20
|
def register
|
17
21
|
return @register if @register
|
18
22
|
|
19
23
|
@register = Lutaml::Hal::ModelRegister.new(name: :w3c_api, client: client)
|
20
|
-
Lutaml::Hal::GlobalRegister.instance.register(
|
24
|
+
Lutaml::Hal::GlobalRegister.instance.register(
|
25
|
+
:w3c_api, @register
|
26
|
+
)
|
21
27
|
@register
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
register.add_endpoint(id: :affiliation_index, type: :index, url: '/affiliations', model: Models::AffiliationIndex)
|
26
|
-
register.add_endpoint(id: :affiliation_resource, type: :resource, url: '/affiliations/{id}',
|
27
|
-
model: Models::Affiliation)
|
28
|
-
register.add_endpoint(id: :affiliation_participants_index, type: :index, url: '/affiliations/{id}/participants',
|
29
|
-
model: Models::ParticipantIndex)
|
30
|
-
register.add_endpoint(id: :affiliation_participations_index, type: :index, url: '/affiliations/{id}/participations',
|
31
|
-
model: Models::ParticipationIndex)
|
32
|
-
|
33
|
-
# register.add_endpoint(id: :charter_resource, type: :resource, url: '/charters/{id}', model: Models::Charter)
|
34
|
-
|
35
|
-
register.add_endpoint(id: :ecosystem_index, type: :index, url: '/ecosystems', model: Models::EcosystemIndex)
|
36
|
-
register.add_endpoint(id: :ecosystem_resource, type: :resource, url: '/ecosystems/{id}', model: Models::Ecosystem)
|
37
|
-
register.add_endpoint(id: :ecosystem_evangelists_index, type: :index, url: '/ecosystems/{shortname}/evangelists',
|
38
|
-
model: Models::EvangelistIndex)
|
39
|
-
register.add_endpoint(id: :ecosystem_groups_index, type: :index, url: '/ecosystems/{shortname}/groups',
|
40
|
-
model: Models::GroupIndex)
|
41
|
-
register.add_endpoint(id: :ecosystem_member_organizations_index, type: :index, url: '/ecosystems/{shortname}/member-organizations',
|
42
|
-
model: Models::AffiliationIndex)
|
43
|
-
|
44
|
-
register.add_endpoint(id: :group_index, type: :index, url: '/groups', model: Models::GroupIndex)
|
45
|
-
register.add_endpoint(id: :group_resource, type: :resource, url: '/groups/{id}', model: Models::Group)
|
46
|
-
register.add_endpoint(id: :group_specifications_index, type: :index, url: '/groups/{id}/specifications',
|
47
|
-
model: Models::SpecificationIndex)
|
48
|
-
register.add_endpoint(id: :group_charters_index, type: :index, url: '/groups/{id}/charters',
|
49
|
-
model: Models::CharterIndex)
|
50
|
-
register.add_endpoint(id: :group_users_index, type: :index, url: '/groups/{id}/users',
|
51
|
-
model: Models::UserIndex)
|
52
|
-
register.add_endpoint(id: :group_chairs_index, type: :index, url: '/groups/{id}/chairs',
|
53
|
-
model: Models::ChairIndex)
|
54
|
-
register.add_endpoint(id: :group_team_contacts_index, type: :index, url: '/groups/{id}/teamcontacts',
|
55
|
-
model: Models::TeamContactIndex)
|
56
|
-
register.add_endpoint(id: :group_participations_index, type: :index, url: '/groups/{id}/participations',
|
57
|
-
model: Models::ParticipationIndex)
|
58
|
-
|
59
|
-
# register.add_endpoint(id: :participation_index, type: :index, url: '/participations', model: Models::ParticipationIndex)
|
60
|
-
register.add_endpoint(id: :participation_resource, type: :resource, url: '/participations/{id}',
|
61
|
-
model: Models::Participation)
|
62
|
-
register.add_endpoint(id: :participation_participants_index, type: :index, url: '/participations/{id}/participants',
|
63
|
-
model: Models::ParticipantIndex)
|
64
|
-
|
65
|
-
register.add_endpoint(id: :serie_index, type: :index, url: '/specification-series', model: Models::SerieIndex)
|
66
|
-
register.add_endpoint(id: :serie_resource, type: :resource, url: '/specification-series/{shortname}',
|
67
|
-
model: Models::Serie)
|
68
|
-
|
69
|
-
register.add_endpoint(id: :serie_specification_resource, type: :index,
|
70
|
-
url: '/specification-series/{shortname}/specifications', model: Models::SpecificationIndex)
|
71
|
-
|
72
|
-
register.add_endpoint(id: :specification_index, type: :index, url: '/specifications',
|
73
|
-
model: Models::SpecificationIndex)
|
74
|
-
register.add_endpoint(id: :specification_resource, type: :resource, url: '/specifications/{shortname}',
|
75
|
-
model: Models::Specification)
|
76
|
-
register.add_endpoint(id: :specification_resource_version_index, type: :index, url: '/specifications/{shortname}/versions',
|
77
|
-
model: Models::SpecVersionIndex)
|
30
|
+
private
|
78
31
|
|
32
|
+
# Common pagination query parameters
|
33
|
+
PAGINATION_PARAMS = {
|
34
|
+
'page' => '{page}',
|
35
|
+
'items' => '{items}'
|
36
|
+
}.freeze
|
37
|
+
|
38
|
+
# Helper method to add index endpoints with pagination
|
39
|
+
def add_index_endpoint(id, url, model, query_params = PAGINATION_PARAMS)
|
79
40
|
register.add_endpoint(
|
80
|
-
id:
|
81
|
-
type: :resource,
|
82
|
-
url: '/specifications/{shortname}/versions/{version}',
|
83
|
-
model: Models::SpecVersion
|
84
|
-
)
|
85
|
-
register.add_endpoint(
|
86
|
-
id: :specification_version_predecessors_index,
|
41
|
+
id: id,
|
87
42
|
type: :index,
|
88
|
-
url:
|
89
|
-
model:
|
43
|
+
url: url,
|
44
|
+
model: model,
|
45
|
+
query_params: query_params
|
90
46
|
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Helper method to add resource endpoints
|
50
|
+
def add_resource_endpoint(id, url, model)
|
91
51
|
register.add_endpoint(
|
92
|
-
id:
|
93
|
-
type: :
|
94
|
-
url:
|
95
|
-
model:
|
52
|
+
id: id,
|
53
|
+
type: :resource,
|
54
|
+
url: url,
|
55
|
+
model: model
|
96
56
|
)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
57
|
+
end
|
58
|
+
|
59
|
+
# Helper method to add nested index endpoints
|
60
|
+
def add_nested_index_endpoints(parent_resource, parent_id_param, endpoints)
|
61
|
+
endpoints.each do |endpoint|
|
62
|
+
add_index_endpoint(
|
63
|
+
:"#{parent_resource}_#{endpoint[:name]}_index",
|
64
|
+
"/#{parent_resource}/#{parent_id_param}/#{endpoint[:path]}",
|
65
|
+
endpoint[:model]
|
66
|
+
)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Helper method to add individual nested endpoints
|
71
|
+
def add_nested_endpoint(parent_resource, parent_id_param, endpoint_name, endpoint_path, model)
|
72
|
+
add_index_endpoint(
|
73
|
+
:"#{parent_resource}_#{endpoint_name}_index",
|
74
|
+
"/#{parent_resource}/#{parent_id_param}/#{endpoint_path}",
|
75
|
+
model
|
102
76
|
)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
77
|
+
end
|
78
|
+
|
79
|
+
def setup
|
80
|
+
# Specification endpoints
|
81
|
+
add_index_endpoint(
|
82
|
+
:specification_index,
|
83
|
+
'/specifications',
|
84
|
+
Models::SpecificationIndex
|
108
85
|
)
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
model: Models::SpecificationIndex
|
86
|
+
add_resource_endpoint(
|
87
|
+
:specification_resource,
|
88
|
+
'/specifications/{shortname}',
|
89
|
+
Models::Specification
|
114
90
|
)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
91
|
+
add_index_endpoint(
|
92
|
+
:specification_by_status_index,
|
93
|
+
'/specifications',
|
94
|
+
Models::SpecificationIndex,
|
95
|
+
{ 'status' => '{status}', **PAGINATION_PARAMS }
|
120
96
|
)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
97
|
+
|
98
|
+
# Specification version endpoints
|
99
|
+
add_index_endpoint(
|
100
|
+
:specification_resource_version_index,
|
101
|
+
'/specifications/{shortname}/versions',
|
102
|
+
Models::SpecVersionIndex
|
103
|
+
)
|
104
|
+
add_resource_endpoint(
|
105
|
+
:specification_resource_version_resource,
|
106
|
+
'/specifications/{shortname}/versions/{version}',
|
107
|
+
Models::SpecVersion
|
126
108
|
)
|
127
109
|
|
110
|
+
# Specification version editors and deliverers
|
111
|
+
add_index_endpoint(
|
112
|
+
:specification_version_editors_index,
|
113
|
+
'/specifications/{shortname}/versions/{version}/editors',
|
114
|
+
Models::EditorIndex
|
115
|
+
)
|
116
|
+
add_index_endpoint(
|
117
|
+
:specification_version_deliverers_index,
|
118
|
+
'/specifications/{shortname}/versions/{version}/deliverers',
|
119
|
+
Models::DelivererIndex
|
120
|
+
)
|
121
|
+
|
122
|
+
# Specification version predecessors and successors
|
123
|
+
add_index_endpoint(
|
124
|
+
:specification_version_predecessors_index,
|
125
|
+
'/specifications/{shortname}/versions/{version}/predecessors',
|
126
|
+
Models::SpecVersionPredecessorIndex
|
127
|
+
)
|
128
|
+
add_index_endpoint(
|
129
|
+
:specification_version_successors_index,
|
130
|
+
'/specifications/{shortname}/versions/{version}/successors',
|
131
|
+
Models::SpecVersionSuccessorIndex
|
132
|
+
)
|
133
|
+
|
134
|
+
# Specification related endpoints
|
135
|
+
%w[supersedes superseded_by editors deliverers].each do |relation|
|
136
|
+
add_index_endpoint(
|
137
|
+
:"specification_#{relation}_index",
|
138
|
+
"/specifications/{shortname}/#{relation.tr('_', '-')}",
|
139
|
+
relation.include?('editor') ? Models::UserIndex : Models::GroupIndex
|
140
|
+
)
|
141
|
+
end
|
142
|
+
|
128
143
|
# TODO: Why is this endpoint needed? There already is /specifications/{shortname}...
|
129
144
|
# register.add_endpoint(
|
130
145
|
# id: :specification_by_shortname_index,
|
@@ -133,32 +148,198 @@ module W3cApi
|
|
133
148
|
# model: Models::SpecificationIndex
|
134
149
|
# )
|
135
150
|
|
136
|
-
|
137
|
-
|
138
|
-
|
151
|
+
# Series endpoints
|
152
|
+
add_index_endpoint(
|
153
|
+
:serie_index,
|
154
|
+
'/specification-series',
|
155
|
+
Models::SerieIndex
|
156
|
+
)
|
157
|
+
add_resource_endpoint(
|
158
|
+
:serie_resource,
|
159
|
+
'/specification-series/{shortname}',
|
160
|
+
Models::Serie
|
161
|
+
)
|
162
|
+
add_index_endpoint(
|
163
|
+
:serie_specification_resource,
|
164
|
+
'/specification-series/{shortname}/specifications',
|
165
|
+
Models::SpecificationIndex
|
166
|
+
)
|
139
167
|
|
140
|
-
#
|
141
|
-
|
168
|
+
# Group endpoints
|
169
|
+
add_index_endpoint(
|
170
|
+
:group_index,
|
171
|
+
'/groups',
|
172
|
+
Models::GroupIndex
|
173
|
+
)
|
174
|
+
add_resource_endpoint(
|
175
|
+
:group_resource,
|
176
|
+
'/groups/{id}',
|
177
|
+
Models::Group
|
178
|
+
)
|
179
|
+
add_resource_endpoint(
|
180
|
+
:group_by_type_shortname_resource,
|
181
|
+
'/groups/{type}/{shortname}',
|
182
|
+
Models::Group
|
183
|
+
)
|
184
|
+
add_index_endpoint(
|
185
|
+
:group_by_type_index,
|
186
|
+
'/groups/{type}',
|
187
|
+
Models::GroupIndex
|
188
|
+
)
|
189
|
+
# Group nested endpoints
|
190
|
+
add_index_endpoint(
|
191
|
+
:group_specifications_index,
|
192
|
+
'/groups/{id}/specifications',
|
193
|
+
Models::SpecificationIndex
|
194
|
+
)
|
195
|
+
add_index_endpoint(
|
196
|
+
:group_users_index,
|
197
|
+
'/groups/{id}/users',
|
198
|
+
Models::UserIndex
|
199
|
+
)
|
200
|
+
add_index_endpoint(
|
201
|
+
:group_charters_index,
|
202
|
+
'/groups/{id}/charters',
|
203
|
+
Models::CharterIndex
|
204
|
+
)
|
205
|
+
add_index_endpoint(
|
206
|
+
:group_chairs_index,
|
207
|
+
'/groups/{id}/chairs',
|
208
|
+
Models::ChairIndex
|
209
|
+
)
|
210
|
+
add_index_endpoint(
|
211
|
+
:group_team_contacts_index,
|
212
|
+
'/groups/{id}/teamcontacts',
|
213
|
+
Models::TeamContactIndex
|
214
|
+
)
|
215
|
+
add_index_endpoint(
|
216
|
+
:group_participations_index,
|
217
|
+
'/groups/{id}/participations',
|
218
|
+
Models::ParticipationIndex
|
219
|
+
)
|
142
220
|
|
143
|
-
|
144
|
-
|
221
|
+
# Translation endpoints
|
222
|
+
add_index_endpoint(
|
223
|
+
:translation_index,
|
224
|
+
'/translations',
|
225
|
+
Models::TranslationIndex
|
226
|
+
)
|
227
|
+
add_resource_endpoint(
|
228
|
+
:translation_resource,
|
229
|
+
'/translations/{id}',
|
230
|
+
Models::Translation
|
231
|
+
)
|
232
|
+
|
233
|
+
# User endpoints
|
234
|
+
# NOTE: This endpoint doesn't exist, just here for reference.
|
235
|
+
# register.add_endpoint(
|
236
|
+
# id: :user_index,
|
237
|
+
# type: :index,
|
238
|
+
# url: '/users',
|
239
|
+
# model: Models::UserIndex
|
240
|
+
# )
|
241
|
+
add_resource_endpoint(
|
242
|
+
:user_resource,
|
243
|
+
'/users/{hash}',
|
244
|
+
Models::User
|
245
|
+
)
|
145
246
|
|
146
|
-
|
247
|
+
# User nested endpoints
|
248
|
+
add_index_endpoint(
|
249
|
+
:user_groups_index,
|
250
|
+
'/users/{hash}/groups',
|
251
|
+
Models::GroupIndex
|
252
|
+
)
|
253
|
+
add_index_endpoint(
|
254
|
+
:user_affiliations_index,
|
255
|
+
'/users/{hash}/affiliations',
|
256
|
+
Models::AffiliationIndex
|
257
|
+
)
|
258
|
+
add_index_endpoint(
|
259
|
+
:user_participations_index,
|
260
|
+
'/users/{hash}/participations',
|
261
|
+
Models::ParticipationIndex
|
262
|
+
)
|
263
|
+
add_index_endpoint(
|
264
|
+
:user_chair_of_groups_index,
|
265
|
+
'/users/{hash}/chair-of-groups',
|
266
|
+
Models::GroupIndex
|
267
|
+
)
|
268
|
+
add_index_endpoint(
|
269
|
+
:user_team_contact_of_groups_index,
|
270
|
+
'/users/{hash}/team-contact-of-groups',
|
271
|
+
Models::GroupIndex
|
272
|
+
)
|
273
|
+
add_index_endpoint(
|
274
|
+
:user_specifications_index,
|
275
|
+
'/users/{hash}/specifications',
|
276
|
+
Models::SpecificationIndex
|
277
|
+
)
|
147
278
|
|
148
|
-
|
149
|
-
|
279
|
+
# Affiliation endpoints
|
280
|
+
add_index_endpoint(
|
281
|
+
:affiliation_index,
|
282
|
+
'/affiliations',
|
283
|
+
Models::AffiliationIndex
|
284
|
+
)
|
285
|
+
add_resource_endpoint(
|
286
|
+
:affiliation_resource,
|
287
|
+
'/affiliations/{id}',
|
288
|
+
Models::Affiliation
|
289
|
+
)
|
150
290
|
|
151
|
-
|
152
|
-
|
291
|
+
# Affiliation nested endpoints
|
292
|
+
add_index_endpoint(
|
293
|
+
:affiliation_participants_index,
|
294
|
+
'/affiliations/{id}/participants',
|
295
|
+
Models::ParticipantIndex
|
296
|
+
)
|
297
|
+
add_index_endpoint(
|
298
|
+
:affiliation_participations_index,
|
299
|
+
'/affiliations/{id}/participations',
|
300
|
+
Models::ParticipationIndex
|
301
|
+
)
|
153
302
|
|
154
|
-
|
155
|
-
|
303
|
+
# Ecosystem endpoints
|
304
|
+
add_index_endpoint(
|
305
|
+
:ecosystem_index,
|
306
|
+
'/ecosystems',
|
307
|
+
Models::EcosystemIndex
|
308
|
+
)
|
309
|
+
add_resource_endpoint(
|
310
|
+
:ecosystem_resource,
|
311
|
+
'/ecosystems/{shortname}',
|
312
|
+
Models::Ecosystem
|
313
|
+
)
|
156
314
|
|
157
|
-
|
158
|
-
|
315
|
+
# Ecosystem nested endpoints
|
316
|
+
add_index_endpoint(
|
317
|
+
:ecosystem_groups_index,
|
318
|
+
'/ecosystems/{shortname}/groups',
|
319
|
+
Models::GroupIndex
|
320
|
+
)
|
321
|
+
add_index_endpoint(
|
322
|
+
:ecosystem_evangelists_index,
|
323
|
+
'/ecosystems/{shortname}/evangelists',
|
324
|
+
Models::EvangelistIndex
|
325
|
+
)
|
326
|
+
add_index_endpoint(
|
327
|
+
:ecosystem_member_organizations_index,
|
328
|
+
'/ecosystems/{shortname}/member-organizations',
|
329
|
+
Models::AffiliationIndex
|
330
|
+
)
|
159
331
|
|
160
|
-
|
161
|
-
|
332
|
+
# Participation endpoints
|
333
|
+
add_resource_endpoint(
|
334
|
+
:participation_resource,
|
335
|
+
'/participations/{id}',
|
336
|
+
Models::Participation
|
337
|
+
)
|
338
|
+
add_index_endpoint(
|
339
|
+
:participation_participants_index,
|
340
|
+
'/participations/{id}/participants',
|
341
|
+
Models::ParticipantIndex
|
342
|
+
)
|
162
343
|
end
|
163
344
|
end
|
164
345
|
end
|
@@ -70,6 +70,18 @@ module W3cApi
|
|
70
70
|
map key.to_s.tr('_', '-'), to: key
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
def participants(client = nil)
|
75
|
+
return nil unless client
|
76
|
+
|
77
|
+
client.affiliation_participants(id)
|
78
|
+
end
|
79
|
+
|
80
|
+
def participations(client = nil)
|
81
|
+
return nil unless client
|
82
|
+
|
83
|
+
client.affiliation_participations(id)
|
84
|
+
end
|
73
85
|
end
|
74
86
|
end
|
75
87
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'group'
|
4
|
+
|
5
|
+
module W3cApi
|
6
|
+
module Models
|
7
|
+
# Collection of deliverers (working groups)
|
8
|
+
class DelivererIndex < Lutaml::Hal::Page
|
9
|
+
hal_link :deliverers, key: 'deliverers', realize_class: 'Group', collection: true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/w3c_api/models/group.rb
CHANGED
@@ -55,7 +55,7 @@ module W3cApi
|
|
55
55
|
module Models
|
56
56
|
# Group model representing a W3C working group
|
57
57
|
class Group < Lutaml::Hal::Resource
|
58
|
-
attribute :id, :
|
58
|
+
attribute :id, :integer
|
59
59
|
attribute :type, :string
|
60
60
|
attribute :name, :string
|
61
61
|
attribute :is_closed, :boolean
|
@@ -89,6 +89,30 @@ module W3cApi
|
|
89
89
|
map key.to_s.tr('_', '-'), to: key
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
def users(client = nil)
|
94
|
+
return nil unless client
|
95
|
+
|
96
|
+
client.group_users(id)
|
97
|
+
end
|
98
|
+
|
99
|
+
def specifications(client = nil)
|
100
|
+
return nil unless client
|
101
|
+
|
102
|
+
client.group_specifications(id)
|
103
|
+
end
|
104
|
+
|
105
|
+
def chairs(client = nil)
|
106
|
+
return nil unless client
|
107
|
+
|
108
|
+
client.group_chairs(id)
|
109
|
+
end
|
110
|
+
|
111
|
+
def team_contacts(client = nil)
|
112
|
+
return nil unless client
|
113
|
+
|
114
|
+
client.group_team_contacts(id)
|
115
|
+
end
|
92
116
|
end
|
93
117
|
end
|
94
118
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module W3cApi
|
4
|
+
module Models
|
5
|
+
# Collection wrapper for groups
|
6
|
+
class Groups
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
attr_accessor :groups
|
10
|
+
|
11
|
+
def initialize(groups = [])
|
12
|
+
@groups = groups
|
13
|
+
end
|
14
|
+
|
15
|
+
def each(&block)
|
16
|
+
@groups.each(&block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def first
|
20
|
+
@groups.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def size
|
24
|
+
@groups.size
|
25
|
+
end
|
26
|
+
|
27
|
+
def empty?
|
28
|
+
@groups.empty?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/w3c_api/models/photo.rb
CHANGED
data/lib/w3c_api/models/serie.rb
CHANGED
@@ -53,6 +53,18 @@ module W3cApi
|
|
53
53
|
map key.to_s.tr('_', '-'), to: key
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
def specifications(client = nil)
|
58
|
+
return nil unless client
|
59
|
+
|
60
|
+
client.series_specifications(shortname)
|
61
|
+
end
|
62
|
+
|
63
|
+
def current_specification(client = nil)
|
64
|
+
return nil unless client
|
65
|
+
|
66
|
+
client.specification(shortname)
|
67
|
+
end
|
56
68
|
end
|
57
69
|
end
|
58
70
|
end
|
@@ -49,11 +49,11 @@ module W3cApi
|
|
49
49
|
attribute :process_rules, :string
|
50
50
|
|
51
51
|
hal_link :self, key: 'self', realize_class: 'SpecVersion'
|
52
|
-
hal_link :editors, key: 'editors', realize_class: '
|
53
|
-
hal_link :deliverers, key: 'deliverers', realize_class: '
|
52
|
+
hal_link :editors, key: 'editors', realize_class: 'EditorIndex'
|
53
|
+
hal_link :deliverers, key: 'deliverers', realize_class: 'DelivererIndex'
|
54
54
|
hal_link :specification, key: 'specification', realize_class: 'Specification'
|
55
|
-
hal_link :
|
56
|
-
hal_link :
|
55
|
+
hal_link :predecessor_versions, key: 'predecessor-version', realize_class: 'SpecVersionPredecessorIndex'
|
56
|
+
hal_link :successor_versions, key: 'successor-version', realize_class: 'SpecVersionSuccessorIndex'
|
57
57
|
|
58
58
|
key_value do
|
59
59
|
%i[
|
@@ -6,8 +6,6 @@ module W3cApi
|
|
6
6
|
module Models
|
7
7
|
class SpecVersionIndex < Lutaml::Hal::Page
|
8
8
|
hal_link :spec_versions, key: 'version-history', realize_class: 'SpecVersion', collection: true
|
9
|
-
hal_link :predecessor_version, key: 'predecessor-version', realize_class: 'SpecVersionIndex', collection: true
|
10
|
-
hal_link :successor_version, key: 'successor-version', realize_class: 'SpecVersionIndex', collection: true
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'spec_version'
|
4
|
+
|
5
|
+
module W3cApi
|
6
|
+
module Models
|
7
|
+
class SpecVersionPredecessorIndex < Lutaml::Hal::Page
|
8
|
+
hal_link :predecessor_versions, key: 'predecessor-version', realize_class: 'SpecVersion', collection: true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'spec_version'
|
4
|
+
|
5
|
+
module W3cApi
|
6
|
+
module Models
|
7
|
+
class SpecVersionSuccessorIndex < Lutaml::Hal::Page
|
8
|
+
hal_link :successor_versions, key: 'successor-version', realize_class: 'SpecVersion', collection: true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|