w3c_api 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +1 -1
  3. data/README.adoc +845 -436
  4. data/lib/w3c_api/cli.rb +20 -20
  5. data/lib/w3c_api/client.rb +66 -195
  6. data/lib/w3c_api/commands/affiliation.rb +33 -33
  7. data/lib/w3c_api/commands/ecosystem.rb +47 -47
  8. data/lib/w3c_api/commands/group.rb +68 -68
  9. data/lib/w3c_api/commands/output_formatter.rb +11 -11
  10. data/lib/w3c_api/commands/participation.rb +20 -22
  11. data/lib/w3c_api/commands/series.rb +26 -26
  12. data/lib/w3c_api/commands/specification.rb +77 -52
  13. data/lib/w3c_api/commands/translation.rb +18 -18
  14. data/lib/w3c_api/commands/user.rb +60 -60
  15. data/lib/w3c_api/hal.rb +164 -0
  16. data/lib/w3c_api/models/account.rb +44 -0
  17. data/lib/w3c_api/models/affiliation.rb +54 -65
  18. data/lib/w3c_api/models/affiliation_index.rb +11 -0
  19. data/lib/w3c_api/models/call_for_translation.rb +15 -39
  20. data/lib/w3c_api/models/chair_index.rb +11 -0
  21. data/lib/w3c_api/models/charter.rb +48 -89
  22. data/lib/w3c_api/models/charter_index.rb +11 -0
  23. data/lib/w3c_api/models/connected_account.rb +21 -30
  24. data/lib/w3c_api/models/ecosystem.rb +20 -42
  25. data/lib/w3c_api/models/{ecosystems.rb → ecosystem_index.rb} +4 -10
  26. data/lib/w3c_api/models/evangelist_index.rb +11 -0
  27. data/lib/w3c_api/models/extension.rb +5 -7
  28. data/lib/w3c_api/models/group.rb +63 -142
  29. data/lib/w3c_api/models/group_index.rb +12 -0
  30. data/lib/w3c_api/models/join_emails.rb +5 -7
  31. data/lib/w3c_api/models/participant_index.rb +11 -0
  32. data/lib/w3c_api/models/participation.rb +31 -90
  33. data/lib/w3c_api/models/participation_index.rb +11 -0
  34. data/lib/w3c_api/models/photo.rb +26 -0
  35. data/lib/w3c_api/models/serie.rb +21 -51
  36. data/lib/w3c_api/models/{series.rb → serie_index.rb} +22 -13
  37. data/lib/w3c_api/models/spec_version.rb +69 -83
  38. data/lib/w3c_api/models/spec_version_index.rb +13 -0
  39. data/lib/w3c_api/models/spec_version_ref.rb +11 -13
  40. data/lib/w3c_api/models/specification.rb +54 -66
  41. data/lib/w3c_api/models/specification_index.rb +10 -0
  42. data/lib/w3c_api/models/team_contact_index.rb +11 -0
  43. data/lib/w3c_api/models/testimonial.rb +17 -0
  44. data/lib/w3c_api/models/translation.rb +33 -72
  45. data/lib/w3c_api/models/{translations.rb → translation_index.rb} +4 -12
  46. data/lib/w3c_api/models/user.rb +95 -165
  47. data/lib/w3c_api/models/user_index.rb +11 -0
  48. data/lib/w3c_api/models.rb +35 -12
  49. data/lib/w3c_api/version.rb +1 -1
  50. data/lib/w3c_api.rb +3 -2
  51. metadata +35 -19
  52. data/lib/w3c_api/models/affiliations.rb +0 -33
  53. data/lib/w3c_api/models/base.rb +0 -39
  54. data/lib/w3c_api/models/call_for_translation_ref.rb +0 -15
  55. data/lib/w3c_api/models/charters.rb +0 -17
  56. data/lib/w3c_api/models/collection_base.rb +0 -79
  57. data/lib/w3c_api/models/delegate_enumerable.rb +0 -54
  58. data/lib/w3c_api/models/groups.rb +0 -38
  59. data/lib/w3c_api/models/link.rb +0 -17
  60. data/lib/w3c_api/models/participations.rb +0 -17
  61. data/lib/w3c_api/models/series_collection.rb +0 -17
  62. data/lib/w3c_api/models/spec_versions.rb +0 -17
  63. data/lib/w3c_api/models/specifications.rb +0 -17
  64. data/lib/w3c_api/models/users.rb +0 -44
data/lib/w3c_api/cli.rb CHANGED
@@ -11,31 +11,31 @@ require_relative 'commands/affiliation'
11
11
  require_relative 'commands/participation'
12
12
 
13
13
  module W3cApi
14
- # Main CLI class that registers all subcommands
15
- class Cli < Thor
16
- # Register subcommands
17
- desc 'specification SUBCOMMAND ...ARGS', 'Work with W3C specifications'
18
- subcommand 'specification', Commands::Specification
14
+ # Main CLI class that registers all subcommands
15
+ class Cli < Thor
16
+ # Register subcommands
17
+ desc 'specification SUBCOMMAND ...ARGS', 'Work with W3C specifications'
18
+ subcommand 'specification', Commands::Specification
19
19
 
20
- desc 'group SUBCOMMAND ...ARGS', 'Work with W3C groups'
21
- subcommand 'group', Commands::Group
20
+ desc 'group SUBCOMMAND ...ARGS', 'Work with W3C groups'
21
+ subcommand 'group', Commands::Group
22
22
 
23
- desc 'user SUBCOMMAND ...ARGS', 'Work with W3C users'
24
- subcommand 'user', Commands::User
23
+ desc 'user SUBCOMMAND ...ARGS', 'Work with W3C users'
24
+ subcommand 'user', Commands::User
25
25
 
26
- desc 'translation SUBCOMMAND ...ARGS', 'Work with W3C translations'
27
- subcommand 'translation', Commands::Translation
26
+ desc 'translation SUBCOMMAND ...ARGS', 'Work with W3C translations'
27
+ subcommand 'translation', Commands::Translation
28
28
 
29
- desc 'ecosystem SUBCOMMAND ...ARGS', 'Work with W3C ecosystems'
30
- subcommand 'ecosystem', Commands::Ecosystem
29
+ desc 'ecosystem SUBCOMMAND ...ARGS', 'Work with W3C ecosystems'
30
+ subcommand 'ecosystem', Commands::Ecosystem
31
31
 
32
- desc 'series SUBCOMMAND ...ARGS', 'Work with W3C specification series'
33
- subcommand 'series', Commands::Series
32
+ desc 'series SUBCOMMAND ...ARGS', 'Work with W3C specification series'
33
+ subcommand 'series', Commands::Series
34
34
 
35
- desc 'affiliation SUBCOMMAND ...ARGS', 'Work with W3C affiliations'
36
- subcommand 'affiliation', Commands::Affiliation
35
+ desc 'affiliation SUBCOMMAND ...ARGS', 'Work with W3C affiliations'
36
+ subcommand 'affiliation', Commands::Affiliation
37
37
 
38
- desc 'participation SUBCOMMAND ...ARGS', 'Work with W3C participations'
39
- subcommand 'participation', Commands::Participation
40
- end
38
+ desc 'participation SUBCOMMAND ...ARGS', 'Work with W3C participations'
39
+ subcommand 'participation', Commands::Participation
40
+ end
41
41
  end
@@ -1,320 +1,191 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'faraday'
4
- require 'faraday/follow_redirects'
5
3
  require 'json'
4
+ require 'rainbow'
5
+ require 'pp'
6
+ require_relative 'hal'
6
7
 
7
8
  module W3cApi
8
- class Error < StandardError; end
9
- class NotFoundError < Error; end
10
- class UnauthorizedError < Error; end
11
- class BadRequestError < Error; end
12
- class ServerError < Error; end
13
-
14
9
  class Client
15
- API_ENDPOINT = 'https://api.w3.org'
16
-
17
- attr_reader :last_response
18
-
19
- def initialize(options = {})
20
- @api_endpoint = options[:api_endpoint] || API_ENDPOINT
21
- @connection = create_connection
22
- @params_default = { page: 1, items: 3000 }
23
- @debug = !ENV['DEBUG_API'].nil?
24
- end
25
-
26
- # Specification methods
27
-
28
10
  def specifications(options = {})
29
- response = get('specifications', options.merge(@params_default))
30
- Models::Specifications.from_response(response['_links']['specifications'])
11
+ Hal.instance.register.fetch(:specification_index)
31
12
  end
32
13
 
33
14
  def specification(shortname, options = {})
34
- response = get("specifications/#{shortname}", options)
35
- Models::Specification.from_response(response)
15
+ Hal.instance.register.fetch(:specification_resource, shortname: shortname)
36
16
  end
37
17
 
38
18
  def specification_versions(shortname, options = {})
39
- response = get("specifications/#{shortname}/versions", options)
40
- Models::SpecVersions.from_response(response['_links']['version-history'])
19
+ Hal.instance.register.fetch(:specification_resource_version_index, shortname: shortname)
41
20
  end
42
21
 
43
22
  def specification_version(shortname, version, options = {})
44
- response = get("specifications/#{shortname}/versions/#{version}", options)
45
- Models::SpecVersion.from_response(response)
23
+ Hal.instance.register.fetch(:specification_resource_version_resource, shortname: shortname, version: version)
46
24
  end
47
25
 
48
26
  def specifications_by_status(status, options = {})
49
- response = get("specifications-by-status/#{status}", options.merge(@params_default))
50
- Models::Specifications.from_response(response['_links']['specifications'])
27
+ Hal.instance.register.fetch(:specification_by_status_index, status: status)
51
28
  end
52
29
 
53
30
  def specification_supersedes(shortname, options = {})
54
- response = get("specifications/#{shortname}/supersedes", options)
55
- Models::Specifications.from_response(response['_links']['specifications'])
31
+ Hal.instance.register.fetch(:specification_supersedes_index, shortname: shortname)
56
32
  end
57
33
 
58
34
  def specification_superseded_by(shortname, options = {})
59
- response = get("specifications/#{shortname}/superseded", options)
60
- Models::Specifications.from_response(response['_links']['specifications'])
35
+ Hal.instance.register.fetch(:specification_superseded_by_index, shortname: shortname)
36
+ end
37
+
38
+ # New methods for editors and deliverers
39
+
40
+ def specification_editors(shortname, options = {})
41
+ Hal.instance.register.fetch(:specification_editors_index, shortname: shortname)
42
+ end
43
+
44
+ def specification_deliverers(shortname, options = {})
45
+ Hal.instance.register.fetch(:specification_deliverers_index, shortname: shortname)
61
46
  end
62
47
 
63
48
  # Series methods
64
49
 
65
50
  def series(options = {})
66
- response = get('specification-series', options.merge(@params_default))
67
- Models::Series.from_response(response['_links']['specification-series'])
51
+ Hal.instance.register.fetch(:serie_index)
68
52
  end
69
53
 
70
54
  def series_by_shortname(shortname, options = {})
71
- response = get("specification-series/#{shortname}", options)
72
- Models::Serie.from_response(response)
55
+ Hal.instance.register.fetch(:serie_resource, shortname: shortname)
73
56
  end
74
57
 
75
58
  def series_specifications(shortname, options = {})
76
- response = get("specification-series/#{shortname}/specifications", options.merge(@params_default))
77
- Models::Specifications.from_response(response['_links']['specifications'])
59
+ Hal.instance.register.fetch(:serie_specification_resource, shortname: shortname)
78
60
  end
79
61
 
80
62
  # Group methods
81
63
 
82
64
  def groups(options = {})
83
- response = get('groups', options)
84
- Models::Groups.from_response(response['_links']['groups'])
65
+ Hal.instance.register.fetch(:group_index)
85
66
  end
86
67
 
87
68
  def group(id, options = {})
88
- response = get("groups/#{id}", options)
89
- Models::Group.from_response(response)
69
+ Hal.instance.register.fetch(:group_resource, id: id)
90
70
  end
91
71
 
92
72
  def group_specifications(id, options = {})
93
- response = get("groups/#{id}/specifications", options)
94
- Models::Specifications.from_response(response['_links']['specifications'])
73
+ Hal.instance.register.fetch(:group_specifications_index, id: id)
95
74
  end
96
75
 
97
76
  def group_users(id, options = {})
98
- response = get("groups/#{id}/users", options)
99
- Models::Users.from_response(response['_links']['users'])
77
+ Hal.instance.register.fetch(:group_users_index, id: id)
100
78
  end
101
79
 
102
80
  def group_charters(id, options = {})
103
- response = get("groups/#{id}/charters", options)
104
- Models::Charters.from_response(response['_links']['charters'])
81
+ Hal.instance.register.fetch(:group_charters_index, id: id)
105
82
  end
106
83
 
107
84
  def group_chairs(id, options = {})
108
- response = get("groups/#{id}/chairs", options)
109
- Models::Users.from_response(response['_links']['chairs'])
110
- rescue NotFoundError
111
- # Return empty users collection when endpoint not found
112
- Models::Users.from_response([])
85
+ Hal.instance.register.fetch(:group_chairs_index, id: id)
113
86
  end
114
87
 
115
88
  def group_team_contacts(id, options = {})
116
- response = get("groups/#{id}/teamcontacts", options)
117
- Models::Users.from_response(response['_links']['team-contacts'])
118
- rescue NotFoundError
119
- # Return empty users collection when endpoint not found
120
- Models::Users.from_response([])
89
+ Hal.instance.register.fetch(:group_team_contacts_index, id: id)
121
90
  end
122
91
 
123
92
  def group_participations(id, options = {})
124
- response = get("groups/#{id}/participations", options)
125
- Models::Participations.from_response(response['_links']['participations'])
93
+ Hal.instance.register.fetch(:group_participations_index, id: id)
126
94
  end
127
95
 
128
96
  # User methods
129
97
 
130
- def users(options = {})
131
- raise ArgumentError,
132
- 'The W3C API does not support fetching all users. You must provide a specific user ID with the user method.'
133
- end
98
+ # def users(options = {})
99
+ # raise ArgumentError,
100
+ # 'The W3C API does not support fetching all users. You must provide a specific user ID with the user method.'
101
+ # end
134
102
 
135
- def user(id, options = {})
136
- response = get("users/#{id}", options)
137
- Models::User.from_response(response)
103
+ def user(hash, options = {})
104
+ Hal.instance.register.fetch(:user_resource, hash: hash)
138
105
  end
139
106
 
140
- def user_specifications(id, options = {})
141
- response = get("users/#{id}/specifications", options)
142
- Models::Specifications.from_response(response['_links']['specifications'])
143
- rescue NotFoundError
144
- # Return empty specifications collection when endpoint not found
145
- Models::Specifications.from_response([])
107
+ def user_groups(hash, options = {})
108
+ Hal.instance.register.fetch(:user_groups_index, hash: hash)
146
109
  end
147
110
 
148
- def user_groups(id, options = {})
149
- response = get("users/#{id}/groups", options)
150
- Models::Groups.from_response(response['_links']['groups'])
111
+ def user_affiliations(hash, options = {})
112
+ Hal.instance.register.fetch(:user_affiliations_index, hash: hash)
151
113
  end
152
114
 
153
- def user_affiliations(id, options = {})
154
- response = get("users/#{id}/affiliations", options)
155
- Models::Affiliations.from_response(response['_links']['affiliations'])
156
- rescue NotFoundError
157
- # Return empty affiliations collection when endpoint not found
158
- Models::Affiliations.from_response([])
115
+ def user_participations(hash, options = {})
116
+ Hal.instance.register.fetch(:user_participations_index, hash: hash)
159
117
  end
160
118
 
161
- def user_participations(id, options = {})
162
- response = get("users/#{id}/participations", options)
163
- Models::Participations.from_response(response['_links']['participations'])
164
- rescue NotFoundError
165
- # Return empty participations collection when endpoint not found
166
- Models::Participations.from_response([])
119
+ def user_chair_of_groups(hash, options = {})
120
+ Hal.instance.register.fetch(:user_chair_of_groups_index, hash: hash)
167
121
  end
168
122
 
169
- def user_chair_of_groups(id, options = {})
170
- response = get("users/#{id}/chair-of-groups", options)
171
- Models::Groups.from_response(response['_links']['groups'])
172
- rescue NotFoundError
173
- # Return empty groups collection when endpoint not found
174
- Models::Groups.from_response([])
123
+ def user_team_contact_of_groups(hash, options = {})
124
+ Hal.instance.register.fetch(:user_team_contact_of_groups_index, hash: hash)
175
125
  end
176
126
 
177
- def user_team_contact_of_groups(id, options = {})
178
- response = get("users/#{id}/team-contact-of-groups", options)
179
- Models::Groups.from_response(response['_links']['groups'])
180
- rescue NotFoundError
181
- # Return empty groups collection when endpoint not found
182
- Models::Groups.from_response([])
127
+ def user_specifications(hash, options = {})
128
+ Hal.instance.register.fetch(:user_specifications_index, hash: hash)
183
129
  end
184
130
 
185
131
  # Translation methods
186
132
 
187
133
  def translations(options = {})
188
- response = get('translations', options.merge(embed: true))
189
- Models::Translations.from_response(response['_links']['translations'])
134
+ Hal.instance.register.fetch(:translation_index)
190
135
  end
191
136
 
192
137
  def translation(id, options = {})
193
- response = get("translations/#{id}", options)
194
- Models::Translation.from_response(response)
138
+ Hal.instance.register.fetch(:translation_resource, id: id)
195
139
  end
196
140
 
197
141
  # Affiliation methods
198
142
 
199
143
  def affiliations(options = {})
200
- response = get('affiliations', options.merge(@params_default))
201
- Models::Affiliations.from_response(response['_links']['affiliations'])
144
+ Hal.instance.register.fetch(:affiliation_index)
202
145
  end
203
146
 
204
147
  def affiliation(id, options = {})
205
- response = get("affiliations/#{id}", options)
206
- Models::Affiliation.from_response(response)
148
+ Hal.instance.register.fetch(:affiliation_resource, id: id)
207
149
  end
208
150
 
209
151
  def affiliation_participants(id, options = {})
210
- response = get("affiliations/#{id}/participants", options)
211
- Models::Users.from_response(response['_links']['participants'])
152
+ Hal.instance.register.fetch(:affiliation_participants_index, id: id)
212
153
  end
213
154
 
214
155
  def affiliation_participations(id, options = {})
215
- response = get("affiliations/#{id}/participations", options)
216
- Models::Participations.from_response(response['_links']['participations'])
156
+ Hal.instance.register.fetch(:affiliation_participations_index, id: id)
217
157
  end
218
158
 
219
159
  # Ecosystem methods
220
160
 
221
161
  def ecosystems(options = {})
222
- response = get('ecosystems', options)
223
- Models::Ecosystems.from_response(response['_links']['ecosystems'])
162
+ Hal.instance.register.fetch(:ecosystem_index)
224
163
  end
225
164
 
226
- def ecosystem(shortname, options = {})
227
- response = get("ecosystems/#{shortname}", options)
228
- Models::Ecosystem.from_response(response)
165
+ def ecosystem(id, options = {})
166
+ Hal.instance.register.fetch(:ecosystem_resource, id: id)
229
167
  end
230
168
 
231
169
  def ecosystem_groups(shortname, options = {})
232
- response = get("ecosystems/#{shortname}/groups", options)
233
- Models::Groups.from_response(response['_links']['groups'])
170
+ Hal.instance.register.fetch(:ecosystem_groups_index, shortname: shortname)
234
171
  end
235
172
 
236
173
  def ecosystem_evangelists(shortname, options = {})
237
- response = get("ecosystems/#{shortname}/evangelists", options)
238
- Models::Users.from_response(response['_links']['users'])
174
+ Hal.instance.register.fetch(:ecosystem_evangelists_index, shortname: shortname)
239
175
  end
240
176
 
241
177
  def ecosystem_member_organizations(shortname, options = {})
242
- response = get("ecosystems/#{shortname}/member-organizations", options)
243
- Models::Affiliations.from_response(response['_links']['affiliations'])
178
+ Hal.instance.register.fetch(:ecosystem_member_organizations_index, shortname: shortname)
244
179
  end
245
180
 
246
181
  # Participation methods
247
182
 
248
183
  def participation(id, options = {})
249
- response = get("participations/#{id}", options)
250
- Models::Participation.from_response(response)
184
+ Hal.instance.register.fetch(:participation_resource, id: id)
251
185
  end
252
186
 
253
187
  def participation_participants(id, options = {})
254
- response = get("participations/#{id}/participants", options)
255
- Models::Users.from_response(response['_links']['users'])
256
- end
257
-
258
- # Make the get method public for testing
259
- def get(url, params = {})
260
- @last_response = @connection.get(url, params)
261
- handle_response(@last_response, url)
262
- end
263
-
264
- private
265
-
266
- def create_connection
267
- Faraday.new(url: @api_endpoint) do |conn|
268
- conn.use Faraday::FollowRedirects::Middleware
269
- conn.request :json
270
- conn.response :json, content_type: /\bjson$/
271
- conn.adapter Faraday.default_adapter
272
- end
273
- end
274
-
275
- def handle_response(response, url)
276
- debug_log(response, url) if @debug
277
-
278
- case response.status
279
- when 200..299
280
- response.body
281
- when 400
282
- raise W3cApi::BadRequestError, response_message(response)
283
- when 401
284
- raise W3cApi::UnauthorizedError, response_message(response)
285
- when 404
286
- raise W3cApi::NotFoundError, response_message(response)
287
- when 500..599
288
- raise W3cApi::ServerError, response_message(response)
289
- else
290
- raise W3cApi::Error, response_message(response)
291
- end
292
- end
293
-
294
- def debug_log(response, url)
295
- puts "\n===== DEBUG: W3C API REQUEST =====".blue if defined?(Rainbow)
296
- puts "\n===== DEBUG: W3C API REQUEST =====" unless defined?(Rainbow)
297
- puts "URL: #{url}"
298
- puts "Status: #{response.status}"
299
-
300
- # Format headers as JSON
301
- puts "\nHeaders:"
302
- headers_hash = response.headers.to_h
303
- puts JSON.pretty_generate(headers_hash)
304
-
305
- puts "\nResponse body:"
306
- if response.body.is_a?(Hash) || response.body.is_a?(Array)
307
- puts JSON.pretty_generate(response.body)
308
- else
309
- puts response.body.inspect
310
- end
311
- puts "===== END DEBUG OUTPUT =====\n"
312
- end
313
-
314
- def response_message(response)
315
- message = "Status: #{response.status}"
316
- message += ", Error: #{response.body['error']}" if response.body.is_a?(Hash) && response.body['error']
317
- message
318
- end
319
- end # End of Client class
320
- end # End of W3c module
188
+ Hal.instance.register.fetch(:participation_participants_index, id: id)
189
+ end
190
+ end
191
+ end
@@ -5,44 +5,44 @@ require_relative 'output_formatter'
5
5
  require_relative '../client'
6
6
 
7
7
  module W3cApi
8
- module Commands
9
- # Thor CLI command for affiliation operations
10
- class Affiliation < Thor
11
- include OutputFormatter
8
+ module Commands
9
+ # Thor CLI command for affiliation operations
10
+ class Affiliation < Thor
11
+ include OutputFormatter
12
12
 
13
- desc 'fetch [OPTIONS]', 'Fetch affiliations'
14
- option :id, type: :numeric, desc: 'Affiliation ID'
15
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
16
- def fetch
17
- client = W3cApi::Client.new
13
+ desc 'fetch [OPTIONS]', 'Fetch affiliations'
14
+ option :id, type: :numeric, desc: 'Affiliation ID'
15
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
16
+ def fetch
17
+ client = W3cApi::Client.new
18
18
 
19
- affiliations = if options[:id]
20
- # Single affiliation
21
- client.affiliation(options[:id])
22
- else
23
- client.affiliations
24
- end
19
+ affiliations = if options[:id]
20
+ # Single affiliation
21
+ client.affiliation(options[:id])
22
+ else
23
+ client.affiliations
24
+ end
25
25
 
26
- output_results(affiliations, options[:format])
27
- end
26
+ output_results(affiliations, options[:format])
27
+ end
28
28
 
29
- desc 'participants', 'Fetch participants of an affiliation'
30
- option :id, type: :numeric, required: true, desc: 'Affiliation ID'
31
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
32
- def participants
33
- client = W3cApi::Client.new
34
- participants = client.affiliation_participants(options[:id])
35
- output_results(participants, options[:format])
36
- end
29
+ desc 'participants', 'Fetch participants of an affiliation'
30
+ option :id, type: :numeric, required: true, desc: 'Affiliation ID'
31
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
32
+ def participants
33
+ client = W3cApi::Client.new
34
+ participants = client.affiliation_participants(options[:id])
35
+ output_results(participants, options[:format])
36
+ end
37
37
 
38
- desc 'participations', 'Fetch participations of an affiliation'
39
- option :id, type: :numeric, required: true, desc: 'Affiliation ID'
40
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
41
- def participations
42
- client = W3cApi::Client.new
43
- participations = client.affiliation_participations(options[:id])
44
- output_results(participations, options[:format])
45
- end
38
+ desc 'participations', 'Fetch participations of an affiliation'
39
+ option :id, type: :numeric, required: true, desc: 'Affiliation ID'
40
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
41
+ def participations
42
+ client = W3cApi::Client.new
43
+ participations = client.affiliation_participations(options[:id])
44
+ output_results(participations, options[:format])
46
45
  end
47
46
  end
47
+ end
48
48
  end
@@ -5,53 +5,53 @@ require_relative 'output_formatter'
5
5
  require_relative '../client'
6
6
 
7
7
  module W3cApi
8
- module Commands
9
- # Thor CLI command for ecosystem operations
10
- class Ecosystem < Thor
11
- include OutputFormatter
12
-
13
- desc 'fetch [OPTIONS]', 'Fetch ecosystems'
14
- option :shortname, type: :string, desc: 'Ecosystem shortname'
15
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
16
- def fetch
17
- client = W3cApi::Client.new
18
-
19
- ecosystems = if options[:shortname]
20
- # Single ecosystem
21
- client.ecosystem(options[:shortname])
22
- else
23
- client.ecosystems
24
- end
25
-
26
- output_results(ecosystems, options[:format])
27
- end
28
-
29
- desc 'groups', 'Fetch groups in an ecosystem'
30
- option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
31
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
32
- def groups
33
- client = W3cApi::Client.new
34
- groups = client.ecosystem_groups(options[:shortname])
35
- output_results(groups, options[:format])
36
- end
37
-
38
- desc 'evangelists', 'Fetch evangelists of an ecosystem'
39
- option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
40
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
41
- def evangelists
42
- client = W3cApi::Client.new
43
- evangelists = client.ecosystem_evangelists(options[:shortname])
44
- output_results(evangelists, options[:format])
45
- end
46
-
47
- desc 'member-organizations', 'Fetch member organizations of an ecosystem'
48
- option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
49
- option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
50
- def member_organizations
51
- client = W3cApi::Client.new
52
- organizations = client.ecosystem_member_organizations(options[:shortname])
53
- output_results(organizations, options[:format])
54
- end
8
+ module Commands
9
+ # Thor CLI command for ecosystem operations
10
+ class Ecosystem < Thor
11
+ include OutputFormatter
12
+
13
+ desc 'fetch [OPTIONS]', 'Fetch ecosystems'
14
+ option :shortname, type: :string, desc: 'Ecosystem shortname'
15
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
16
+ def fetch
17
+ client = W3cApi::Client.new
18
+
19
+ ecosystems = if options[:shortname]
20
+ # Single ecosystem
21
+ client.ecosystem(options[:shortname])
22
+ else
23
+ client.ecosystems
24
+ end
25
+
26
+ output_results(ecosystems, options[:format])
27
+ end
28
+
29
+ desc 'groups', 'Fetch groups in an ecosystem'
30
+ option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
31
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
32
+ def groups
33
+ client = W3cApi::Client.new
34
+ groups = client.ecosystem_groups(options[:shortname])
35
+ output_results(groups, options[:format])
36
+ end
37
+
38
+ desc 'evangelists', 'Fetch evangelists of an ecosystem'
39
+ option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
40
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
41
+ def evangelists
42
+ client = W3cApi::Client.new
43
+ evangelists = client.ecosystem_evangelists(options[:shortname])
44
+ output_results(evangelists, options[:format])
45
+ end
46
+
47
+ desc 'member-organizations', 'Fetch member organizations of an ecosystem'
48
+ option :shortname, type: :string, required: true, desc: 'Ecosystem shortname'
49
+ option :format, type: :string, default: 'yaml', enum: %w[json yaml], desc: 'Output format'
50
+ def member_organizations
51
+ client = W3cApi::Client.new
52
+ organizations = client.ecosystem_member_organizations(options[:shortname])
53
+ output_results(organizations, options[:format])
55
54
  end
56
55
  end
56
+ end
57
57
  end