w3c_api 0.1.3 → 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 +23 -32
- data/README.adoc +297 -827
- data/Rakefile +3 -3
- data/demo/rate_limiting_demo.rb +135 -0
- data/demo/test_embed_functionality.rb +88 -0
- 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 +30 -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 +40 -0
- data/lib/w3c_api/hal.rb +374 -164
- 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 -7
- metadata +10 -19
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require "thor"
|
4
|
+
require_relative "output_formatter"
|
5
|
+
require_relative "../client"
|
6
6
|
|
7
7
|
module W3cApi
|
8
8
|
module Commands
|
@@ -10,63 +10,75 @@ module W3cApi
|
|
10
10
|
class User < Thor
|
11
11
|
include OutputFormatter
|
12
12
|
|
13
|
-
desc
|
14
|
-
option :id, type: :string, required: true, desc:
|
15
|
-
option :format, type: :string, default:
|
13
|
+
desc "fetch [OPTIONS]", "Fetch a user by ID"
|
14
|
+
option :id, type: :string, required: true, desc: "User ID (required)"
|
15
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
16
|
+
desc: "Output format"
|
16
17
|
def fetch
|
17
18
|
client = W3cApi::Client.new
|
18
19
|
user = client.user(options[:id])
|
19
20
|
output_results(user, options[:format])
|
20
21
|
end
|
21
22
|
|
22
|
-
desc
|
23
|
-
option :id, type: :string, required: true, desc:
|
24
|
-
option :format, type: :string, default:
|
23
|
+
desc "groups", "Fetch groups a user is a member of"
|
24
|
+
option :id, type: :string, required: true, desc: "User ID"
|
25
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
26
|
+
desc: "Output format"
|
25
27
|
def groups
|
26
28
|
client = W3cApi::Client.new
|
27
29
|
groups = client.user_groups(options[:id])
|
28
30
|
output_results(groups, options[:format])
|
29
31
|
end
|
30
32
|
|
31
|
-
desc
|
32
|
-
option :id, type: :string, required: true,
|
33
|
-
|
33
|
+
desc "specifications", "Fetch specifications a user has contributed to"
|
34
|
+
option :id, type: :string, required: true,
|
35
|
+
desc: "User ID (string or numeric)"
|
36
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
37
|
+
desc: "Output format"
|
34
38
|
def specifications
|
35
39
|
client = W3cApi::Client.new
|
36
40
|
specifications = client.user_specifications(options[:id])
|
37
41
|
output_results(specifications, options[:format])
|
38
42
|
end
|
39
43
|
|
40
|
-
desc
|
41
|
-
option :id, type: :string, required: true,
|
42
|
-
|
44
|
+
desc "affiliations", "Fetch affiliations of a user"
|
45
|
+
option :id, type: :string, required: true,
|
46
|
+
desc: "User ID (string or numeric)"
|
47
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
48
|
+
desc: "Output format"
|
43
49
|
def affiliations
|
44
50
|
client = W3cApi::Client.new
|
45
51
|
affiliations = client.user_affiliations(options[:id])
|
46
52
|
output_results(affiliations, options[:format])
|
47
53
|
end
|
48
54
|
|
49
|
-
desc
|
50
|
-
option :id, type: :string, required: true,
|
51
|
-
|
55
|
+
desc "participations", "Fetch participations of a user"
|
56
|
+
option :id, type: :string, required: true,
|
57
|
+
desc: "User ID (string or numeric)"
|
58
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
59
|
+
desc: "Output format"
|
52
60
|
def participations
|
53
61
|
client = W3cApi::Client.new
|
54
62
|
participations = client.user_participations(options[:id])
|
55
63
|
output_results(participations, options[:format])
|
56
64
|
end
|
57
65
|
|
58
|
-
desc
|
59
|
-
option :id, type: :string, required: true,
|
60
|
-
|
66
|
+
desc "chair-of-groups", "Fetch groups a user chairs"
|
67
|
+
option :id, type: :string, required: true,
|
68
|
+
desc: "User ID (string or numeric)"
|
69
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
70
|
+
desc: "Output format"
|
61
71
|
def chair_of_groups
|
62
72
|
client = W3cApi::Client.new
|
63
73
|
groups = client.user_chair_of_groups(options[:id])
|
64
74
|
output_results(groups, options[:format])
|
65
75
|
end
|
66
76
|
|
67
|
-
desc
|
68
|
-
option :id, type: :string, required: true,
|
69
|
-
|
77
|
+
desc "team-contact-of-groups", "Fetch groups a user is a team contact of"
|
78
|
+
option :id, type: :string, required: true,
|
79
|
+
desc: "User ID (string or numeric)"
|
80
|
+
option :format, type: :string, default: "yaml", enum: %w[json yaml],
|
81
|
+
desc: "Output format"
|
70
82
|
def team_contact_of_groups
|
71
83
|
client = W3cApi::Client.new
|
72
84
|
groups = client.user_team_contact_of_groups(options[:id])
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module W3cApi
|
4
|
+
# Module for discovering and working with embed-supported endpoints
|
5
|
+
module Embed
|
6
|
+
class << self
|
7
|
+
# Get list of endpoints that support embed parameter
|
8
|
+
def supported_endpoints
|
9
|
+
W3cApi::Client.embed_supported_endpoints
|
10
|
+
end
|
11
|
+
|
12
|
+
# Check if a specific endpoint supports embed
|
13
|
+
def supports_embed?(endpoint_id)
|
14
|
+
supported_endpoints.include?(endpoint_id.to_sym)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get human-readable descriptions of embed-supported endpoints
|
18
|
+
def endpoint_descriptions
|
19
|
+
{
|
20
|
+
specification_index: "Specifications index with embedded specification details",
|
21
|
+
group_index: "Groups index with embedded group details",
|
22
|
+
serie_index: "Series index with embedded series details",
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get comprehensive embed information
|
27
|
+
def embed_info
|
28
|
+
{
|
29
|
+
supported_endpoints: supported_endpoints,
|
30
|
+
descriptions: endpoint_descriptions,
|
31
|
+
usage_example: {
|
32
|
+
discovery: "W3cApi::Client.embed_supported_endpoints",
|
33
|
+
usage: "W3cApi::Client.new.specifications(embed: true, items: 2)",
|
34
|
+
automatic_realization: "spec_link.realize # Uses embedded content automatically",
|
35
|
+
},
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|