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
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
3
  # {
6
4
  # "created"=>"2019-07-18T21:28:31+00:00",
7
5
  # "updated"=>"2021-01-21T10:49:57+00:00",
@@ -18,37 +16,30 @@ require 'lutaml/model'
18
16
  # }
19
17
 
20
18
  module W3cApi
21
- module Models
22
- class ConnectedAccountLinks < Lutaml::Model::Serializable
23
- attribute :user, Link
24
- end
19
+ module Models
20
+ class ConnectedAccount < Lutaml::Hal::Resource
21
+ attribute :created, :date_time
22
+ attribute :updated, :date_time
23
+ attribute :service, :string
24
+ attribute :identifier, :string
25
+ attribute :nickname, :string
26
+ attribute :profile_picture, :string
27
+ attribute :href, :string
25
28
 
26
- class ConnectedAccount < Base
27
- attribute :created, :date_time
28
- attribute :updated, :date_time
29
- attribute :service, :string
30
- attribute :identifier, :string
31
- attribute :nickname, :string
32
- attribute :profile_picture, :string
33
- attribute :href, :string
34
- attribute :_links, ConnectedAccountLinks
29
+ hal_link :user, key: 'user', realize_class: 'User'
35
30
 
36
- def self.from_response(response)
37
- transformed_response = transform_keys(response)
38
- account = new
39
- transformed_response.each do |key, value|
40
- case key
41
- when :_links
42
- links = value.each_with_object({}) do |(link_name, link_data), acc|
43
- acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
44
- end
45
- account._links = ConnectedAccountLinks.new(links)
46
- else
47
- account.send("#{key}=", value) if account.respond_to?("#{key}=")
48
- end
49
- end
50
- account
31
+ key_value do
32
+ %i[
33
+ created
34
+ updated
35
+ service
36
+ identifier
37
+ nickname
38
+ profile_picture
39
+ ].each do |key|
40
+ map key.to_s.tr('_', '-'), to: key
51
41
  end
52
42
  end
53
43
  end
44
+ end
54
45
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
4
- require_relative 'link'
5
-
6
3
  # {
7
4
  # "name": "Data and knowledge"
8
5
  # "shortname": "data"
@@ -27,46 +24,27 @@ require_relative 'link'
27
24
  # }
28
25
 
29
26
  module W3cApi
30
- module Models
31
- class EcosystemLinks < Lutaml::Model::Serializable
32
- attribute :self, Link
33
- attribute :champion, Link
34
- attribute :evangelists, Link
35
- attribute :groups, Link
36
- attribute :member_organizations, Link
37
- end
38
-
39
- class Ecosystem < Base
40
- attribute :name, :string
41
- attribute :shortname, :string
42
- attribute :href, :string
43
- attribute :title, :string
44
- attribute :_links, EcosystemLinks
45
-
46
- # Return groups in this ecosystem
47
- def groups(client = nil)
48
- return nil unless client && _links&.groups
49
-
50
- client.ecosystem_groups(shortname)
51
- end
52
-
53
- def self.from_response(response)
54
- transformed_response = transform_keys(response)
55
-
56
- ecosystem = new
57
- transformed_response.each do |key, value|
58
- case key
59
- when :_links
60
- links = value.each_with_object({}) do |(link_name, link_data), acc|
61
- acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
62
- end
63
- ecosystem._links = EcosystemLinks.new(links)
64
- else
65
- ecosystem.send("#{key}=", value) if ecosystem.respond_to?("#{key}=")
66
- end
67
- end
68
- ecosystem
27
+ module Models
28
+ class Ecosystem < Lutaml::Hal::Resource
29
+ attribute :name, :string
30
+ attribute :shortname, :string
31
+ attribute :href, :string
32
+ attribute :title, :string
33
+
34
+ hal_link :self, key: 'self', realize_class: 'Ecosystem'
35
+ hal_link :champion, key: 'champion', realize_class: 'User'
36
+ hal_link :evangelists, key: 'evangelists', realize_class: 'EvangelistIndex'
37
+ hal_link :groups, key: 'groups', realize_class: 'GroupIndex'
38
+ hal_link :member_organizations, key: 'member-organizations', realize_class: 'AffiliationIndex'
39
+
40
+ key_value do
41
+ %i[
42
+ name
43
+ shortname
44
+ ].each do |key|
45
+ map key.to_s.tr('_', '-'), to: key
69
46
  end
70
47
  end
71
48
  end
49
+ end
72
50
  end
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
3
  require_relative 'ecosystem'
5
- require_relative 'delegate_enumerable'
6
- require_relative 'collection_base'
7
4
 
8
5
  # {
9
6
  # "page": 1,
@@ -22,12 +19,9 @@ require_relative 'collection_base'
22
19
  # },
23
20
 
24
21
  module W3cApi
25
- module Models
26
- class Ecosystems < CollectionBase
27
- attribute :ecosystems, Ecosystem, collection: true
28
-
29
- delegate_enumerable :ecosystems
30
- collection_instance_class Ecosystem, :ecosystems
31
- end
22
+ module Models
23
+ class EcosystemIndex < Lutaml::Hal::Page
24
+ hal_link :ecosystems, key: 'ecosystems', realize_class: 'Ecosystem', collection: true
32
25
  end
26
+ end
33
27
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'user'
4
+
5
+ module W3cApi
6
+ module Models
7
+ class EvangelistIndex < Lutaml::Hal::Page
8
+ hal_link :evangelists, key: 'evangelists', realize_class: 'User', collection: true
9
+ end
10
+ end
11
+ end
@@ -1,12 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
3
  module W3cApi
6
- module Models
7
- class Extension < Lutaml::Model::Serializable
8
- attribute :end, :string
9
- attribute :announcement, :string
10
- end
4
+ module Models
5
+ class Extension < Lutaml::Model::Serializable
6
+ attribute :end, :date_time
7
+ attribute :announcement_uri, :string
11
8
  end
9
+ end
12
10
  end
@@ -1,172 +1,93 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
4
- require_relative 'join_emails'
5
- require_relative 'link'
6
-
3
+ # https://api.w3.org/groups/109735
7
4
  # {
8
- # "id": 35422
9
- # "name": "Accessibility Guidelines Working Group"
10
- # "is_closed": false
11
- # "description": "The mission of the Accessibility Guidelines Working Group (AG WG) is to develop specifications to make content on the Web accessible for people with disabilities and to participate in the development and maintenance of implementation support materials for the Web Content Accessibility Guidelines."
12
- # "shortname": "ag"
13
- # "discr": "w3cgroup"
5
+ # "id": 109735,
6
+ # "name": "Immersive Web Working Group",
7
+ # "is_closed": false,
8
+ # "description": "The mission of the Immersive Web Working Group is to help bring high-performance Virtual Reality (VR) and Augmented Reality (AR) (collectively known as XR) to the open Web via APIs to interact with XR devices and sensors in browsers.",
9
+ # "shortname": "immersive-web",
10
+ # "discr": "w3cgroup",
14
11
  # "_links": {
15
12
  # "self": {
16
- # "href": "https://api.w3.org/groups/wg/ag"
17
- # }
13
+ # "href": "https://api.w3.org/groups/wg/immersive-web"
14
+ # },
18
15
  # "homepage": {
19
- # "href": "https://www.w3.org/WAI/GL/"
20
- # }
16
+ # "href": "https://www.w3.org/immersive-web/"
17
+ # },
21
18
  # "users": {
22
- # "href": "https://api.w3.org/groups/wg/ag/users"
23
- # }
19
+ # "href": "https://api.w3.org/groups/wg/immersive-web/users"
20
+ # },
24
21
  # "services": {
25
- # "href": "https://api.w3.org/groups/wg/ag/services"
26
- # }
22
+ # "href": "https://api.w3.org/groups/wg/immersive-web/services"
23
+ # },
27
24
  # "specifications": {
28
- # "href": "https://api.w3.org/groups/wg/ag/specifications"
29
- # }
25
+ # "href": "https://api.w3.org/groups/wg/immersive-web/specifications"
26
+ # },
30
27
  # "chairs": {
31
- # "href": "https://api.w3.org/groups/wg/ag/chairs"
32
- # }
28
+ # "href": "https://api.w3.org/groups/wg/immersive-web/chairs"
29
+ # },
33
30
  # "team-contacts": {
34
- # "href": "https://api.w3.org/groups/wg/ag/teamcontacts"
35
- # }
31
+ # "href": "https://api.w3.org/groups/wg/immersive-web/teamcontacts"
32
+ # },
36
33
  # "charters": {
37
- # "href": "https://api.w3.org/groups/wg/ag/charters"
38
- # }
34
+ # "href": "https://api.w3.org/groups/wg/immersive-web/charters"
35
+ # },
39
36
  # "active-charter": {
40
- # "href": "https://api.w3.org/groups/wg/ag/charters/492"
41
- # }
37
+ # "href": "https://api.w3.org/groups/wg/immersive-web/charters/514"
38
+ # },
42
39
  # "join": {
43
- # "href": "https://www.w3.org/groups/wg/ag/join"
44
- # }
40
+ # "href": "https://www.w3.org/groups/wg/immersive-web/join"
41
+ # },
45
42
  # "pp-status": {
46
- # "href": "https://www.w3.org/groups/wg/ag/ipr"
47
- # }
43
+ # "href": "https://www.w3.org/groups/wg/immersive-web/ipr"
44
+ # },
48
45
  # "participations": {
49
- # "href": "https://api.w3.org/groups/wg/ag/participations"
46
+ # "href": "https://api.w3.org/groups/wg/immersive-web/participations"
50
47
  # }
51
- # }
52
- # "type": "working group"
53
- # "start-date": "1997-10-06"
54
- # "end-date": "2025-10-31"
48
+ # },
49
+ # "type": "working group",
50
+ # "start-date": "2018-09-24",
51
+ # "end-date": "2026-09-25"
55
52
  # }
56
53
 
57
54
  module W3cApi
58
55
  module Models
59
- class GroupLinks < Lutaml::Model::Serializable
60
- attribute :self, Link
61
- attribute :homepage, Link
62
- attribute :users, Link
63
- attribute :services, Link
64
- attribute :specifications, Link
65
- attribute :chairs, Link
66
- attribute :team_contacts, Link
67
- attribute :charters, Link
68
- attribute :active_charter, Link
69
- attribute :join, Link
70
- attribute :pp_status, Link
71
- attribute :participations, Link
72
- end
73
-
74
- class Group < Base
75
- attribute :id, :integer
76
- attribute :name, :string
56
+ # Group model representing a W3C working group
57
+ class Group < Lutaml::Hal::Resource
58
+ attribute :id, :string
77
59
  attribute :type, :string
78
- attribute :href, :string
79
- attribute :title, :string
60
+ attribute :name, :string
61
+ attribute :is_closed, :boolean
80
62
  attribute :description, :string
81
63
  attribute :shortname, :string
82
- attribute :shortlink, :string
83
64
  attribute :discr, :string
84
- attribute :created, :string # Date-time format
85
- attribute :start_date, :string # Date-time format
86
- attribute :end_date, :string # Date-time format
87
- attribute :is_closed, :boolean
88
- attribute :patent_policy, :string
89
- attribute :charter_closed, :boolean
90
- attribute :join_emails, JoinEmails
91
- attribute :_links, GroupLinks
92
-
93
- # Return users in this group
94
- def users(client = nil)
95
- return nil unless client && _links&.users
96
-
97
- client.group_users(id)
98
- end
99
-
100
- # Return specifications in this group
101
- def specifications(client = nil)
102
- return nil unless client && _links&.specifications
103
-
104
- client.group_specifications(id)
105
- end
106
-
107
- # Return charters for this group
108
- def charters(client = nil)
109
- return nil unless client && _links&.charters
110
-
111
- client.group_charters(id)
112
- end
113
-
114
- # Return chairs for this group
115
- def chairs(client = nil)
116
- return nil unless client && _links&.chairs
117
-
118
- client.group_chairs(id)
119
- end
120
-
121
- # Return team contacts for this group
122
- def team_contacts(client = nil)
123
- return nil unless client && _links&.team_contacts
124
-
125
- client.group_team_contacts(id)
126
- end
127
-
128
- # Parse date strings to Date objects
129
- def created_date
130
- Date.parse(created) if created
131
- rescue Date::Error
132
- nil
133
- end
134
-
135
- def start_date_parsed
136
- Date.parse(start_date) if start_date
137
- rescue Date::Error
138
- nil
139
- end
140
-
141
- def end_date_parsed
142
- Date.parse(end_date) if end_date
143
- rescue Date::Error
144
- nil
145
- end
146
-
147
- # Check if this group is active
148
- def active?
149
- !is_closed && (!end_date || Date.parse(end_date) > Date.today)
150
- rescue Date::Error
151
- !is_closed
152
- end
153
-
154
- def self.from_response(response)
155
- transformed_response = transform_keys(response)
156
65
 
157
- group = new
158
- transformed_response.each do |key, value|
159
- case key
160
- when :_links
161
- links = value.each_with_object({}) do |(link_name, link_data), acc|
162
- acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
163
- end
164
- group._links = GroupLinks.new(links)
165
- else
166
- group.send("#{key}=", value) if group.respond_to?("#{key}=")
167
- end
66
+ hal_link :self, key: 'self', realize_class: 'Group'
67
+ hal_link :homepage, key: 'homepage', realize_class: 'String'
68
+ hal_link :users, key: 'users', realize_class: 'UserIndex'
69
+ # hal_link :services, key: 'services', realize_class: 'ServiceIndex'
70
+ hal_link :specifications, key: 'specifications', realize_class: 'SpecificationIndex'
71
+ hal_link :chairs, key: 'chairs', realize_class: 'UserIndex'
72
+ hal_link :team_contacts, key: 'team-contacts', realize_class: 'UserIndex'
73
+ hal_link :charters, key: 'charters', realize_class: 'CharterIndex'
74
+ hal_link :active_charters, key: 'active-charter', realize_class: 'Charter'
75
+ hal_link :join, key: 'join', realize_class: 'String'
76
+ hal_link :pp_status, key: 'pp-status', realize_class: 'String'
77
+ hal_link :participations, key: 'participations', realize_class: 'ParticipationIndex'
78
+
79
+ key_value do
80
+ %i[
81
+ id
82
+ type
83
+ name
84
+ is_closed
85
+ description
86
+ shortname
87
+ discr
88
+ ].each do |key|
89
+ map key.to_s.tr('_', '-'), to: key
168
90
  end
169
- group
170
91
  end
171
92
  end
172
93
  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 groups
8
+ class GroupIndex < Lutaml::Hal::Page
9
+ hal_link :groups, key: 'groups', realize_class: 'Group', collection: true
10
+ end
11
+ end
12
+ end
@@ -1,12 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
-
5
3
  module W3cApi
6
- module Models
7
- class JoinEmails < Lutaml::Model::Serializable
8
- attribute :public, :string
9
- attribute :member, :string
10
- end
4
+ module Models
5
+ class JoinEmailIndex < Lutaml::Model::Serializable
6
+ attribute :public, :string
7
+ attribute :member, :string
11
8
  end
9
+ end
12
10
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'user'
4
+
5
+ module W3cApi
6
+ module Models
7
+ class ParticipantIndex < Lutaml::Hal::Page
8
+ hal_link :participants, key: 'participants', realize_class: 'User', collection: true
9
+ end
10
+ end
11
+ end
@@ -1,109 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
4
- require_relative 'link'
5
-
6
- # Example participation response:
3
+ # https://api.w3.org/participations/38785
7
4
  # {
8
- # "created": "2023-01-01T12:00:00Z",
5
+ # "individual": false,
6
+ # "invited-expert": false,
7
+ # "created": "2022-11-17 22:54:08",
9
8
  # "_links": {
10
9
  # "self": {
11
- # "href": "https://api.w3.org/participations/123"
10
+ # "href": "https://api.w3.org/participations/38785"
12
11
  # },
13
12
  # "group": {
14
- # "href": "https://api.w3.org/groups/456",
15
- # "title": "Example Group"
16
- # },
17
- # "user": {
18
- # "href": "https://api.w3.org/users/789",
19
- # "title": "John Doe"
13
+ # "href": "https://api.w3.org/groups/cg/silver",
14
+ # "title": "Silver Community Group"
20
15
  # },
21
16
  # "organization": {
22
- # "href": "https://api.w3.org/affiliations/101",
23
- # "title": "Example Organization"
17
+ # "href": "https://api.w3.org/affiliations/1092",
18
+ # "title": "MITRE Corporation"
24
19
  # },
25
20
  # "participants": {
26
- # "href": "https://api.w3.org/participations/123/participants"
21
+ # "href": "https://api.w3.org/participations/38785/participants"
27
22
  # }
28
23
  # }
29
24
  # }
30
-
31
25
  module W3cApi
32
- module Models
33
- class ParticipationLinks < Lutaml::Model::Serializable
34
- attribute :self, Link
35
- attribute :group, Link
36
- attribute :user, Link
37
- attribute :organization, Link
38
- attribute :participants, Link
39
- end
40
-
41
- class Participation < Base
42
- attribute :title, :string
43
- attribute :href, :string
44
- attribute :created, :date_time # Date-time format
45
- attribute :_links, ParticipationLinks
46
-
47
- # Parse date strings to Date objects
48
- def created_date
49
- Date.parse(created) if created
50
- rescue Date::Error
51
- nil
52
- end
53
-
54
- # Get the group this participation is for
55
- def group(client = nil)
56
- return nil unless client && _links&.group
57
-
58
- href = _links.group.href
59
- id = href.split('/').last
60
- client.group(id)
61
- end
62
-
63
- # Get the user participating
64
- def user(client = nil)
65
- return nil unless client && _links&.user
66
-
67
- href = _links.user.href
68
- id = href.split('/').last
69
- client.user(id)
70
- end
71
-
72
- # Get the organization participating
73
- def organization(client = nil)
74
- return nil unless client && _links&.organization
75
-
76
- href = _links.organization.href
77
- id = href.split('/').last
78
- client.affiliation(id)
79
- end
80
-
81
- # Get participants in this participation
82
- def participants(client = nil)
83
- return nil unless client && _links&.participants
84
-
85
- href = _links.participants.href
86
- id = href.split('/').last
87
- client.participation_participants(id)
88
- end
89
-
90
- def self.from_response(response)
91
- transformed_response = transform_keys(response)
92
-
93
- participation = new
94
- transformed_response.each do |key, value|
95
- case key
96
- when :_links
97
- links = value.each_with_object({}) do |(link_name, link_data), acc|
98
- acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
99
- end
100
- participation._links = ParticipationLinks.new(links)
101
- else
102
- participation.send("#{key}=", value) if participation.respond_to?("#{key}=")
103
- end
104
- end
105
- participation
26
+ module Models
27
+ class Participation < Lutaml::Hal::Resource
28
+ attribute :title, :string
29
+ attribute :href, :string
30
+ attribute :created, :date_time
31
+ attribute :individual, :boolean
32
+ attribute :invited_expert, :boolean
33
+
34
+ hal_link :self, key: 'self', realize_class: 'Participation'
35
+ hal_link :group, key: 'group', realize_class: 'Group'
36
+ hal_link :organization, key: 'organization', realize_class: 'Affiliation'
37
+ hal_link :participants, key: 'participants', realize_class: 'ParticipantIndex'
38
+
39
+ key_value do
40
+ %i[
41
+ individual
42
+ invited_expert
43
+ created
44
+ ].each do |key|
45
+ map key.to_s.tr('_', '-'), to: key
106
46
  end
107
47
  end
108
48
  end
49
+ end
109
50
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'participation'
4
+
5
+ module W3cApi
6
+ module Models
7
+ class ParticipationIndex < Lutaml::Hal::Page
8
+ hal_link :participations, key: 'participations', realize_class: 'Participation', collection: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ require 'lutaml/model'
2
+
3
+ # "photos": [
4
+ # {
5
+ # "href": "https://www.w3.org/thumbnails/360/avatar-images/f1ovb5rydm8s0go04oco0cgk0sow44w.webp?x-version=3",
6
+ # "name": "large"
7
+ # },
8
+
9
+ module W3cApi
10
+ module Models
11
+ # User model representing a W3C user/participant
12
+ class Photo < Lutaml::Model::Serializable
13
+ attribute :href, :string
14
+ attribute :name, :string
15
+
16
+ key_value do
17
+ %i[
18
+ href
19
+ name
20
+ ].each do |key|
21
+ map key.to_s, to: key
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end