w3c_api 0.1.0 → 0.1.2

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.rubocop_todo.yml +40 -0
  4. data/LICENSE.md +1 -1
  5. data/README.adoc +1032 -439
  6. data/Rakefile +7 -3
  7. data/lib/w3c_api/cli.rb +20 -20
  8. data/lib/w3c_api/client.rb +57 -237
  9. data/lib/w3c_api/commands/affiliation.rb +33 -33
  10. data/lib/w3c_api/commands/ecosystem.rb +47 -47
  11. data/lib/w3c_api/commands/group.rb +68 -68
  12. data/lib/w3c_api/commands/output_formatter.rb +11 -11
  13. data/lib/w3c_api/commands/participation.rb +20 -22
  14. data/lib/w3c_api/commands/series.rb +26 -26
  15. data/lib/w3c_api/commands/specification.rb +77 -52
  16. data/lib/w3c_api/commands/translation.rb +18 -18
  17. data/lib/w3c_api/commands/user.rb +60 -60
  18. data/lib/w3c_api/hal.rb +294 -0
  19. data/lib/w3c_api/models/account.rb +46 -0
  20. data/lib/w3c_api/models/affiliation.rb +54 -65
  21. data/lib/w3c_api/models/affiliation_index.rb +11 -0
  22. data/lib/w3c_api/models/call_for_translation.rb +15 -39
  23. data/lib/w3c_api/models/chair_index.rb +11 -0
  24. data/lib/w3c_api/models/charter.rb +48 -89
  25. data/lib/w3c_api/models/charter_index.rb +11 -0
  26. data/lib/w3c_api/models/connected_account.rb +21 -30
  27. data/lib/w3c_api/models/ecosystem.rb +20 -42
  28. data/lib/w3c_api/models/{ecosystems.rb → ecosystem_index.rb} +4 -10
  29. data/lib/w3c_api/models/evangelist_index.rb +11 -0
  30. data/lib/w3c_api/models/extension.rb +5 -7
  31. data/lib/w3c_api/models/group.rb +63 -142
  32. data/lib/w3c_api/models/group_index.rb +12 -0
  33. data/lib/w3c_api/models/group_link_set.rb +24 -0
  34. data/lib/w3c_api/models/join_emails.rb +5 -7
  35. data/lib/w3c_api/models/participant_index.rb +11 -0
  36. data/lib/w3c_api/models/participation.rb +31 -90
  37. data/lib/w3c_api/models/participation_index.rb +11 -0
  38. data/lib/w3c_api/models/photo.rb +28 -0
  39. data/lib/w3c_api/models/serie.rb +21 -51
  40. data/lib/w3c_api/models/{series.rb → serie_index.rb} +22 -13
  41. data/lib/w3c_api/models/spec_version.rb +69 -83
  42. data/lib/w3c_api/models/spec_version_index.rb +14 -0
  43. data/lib/w3c_api/models/spec_version_ref.rb +11 -13
  44. data/lib/w3c_api/models/specification.rb +54 -66
  45. data/lib/w3c_api/models/specification_index.rb +12 -0
  46. data/lib/w3c_api/models/team_contact_index.rb +11 -0
  47. data/lib/w3c_api/models/testimonial.rb +19 -0
  48. data/lib/w3c_api/models/translation.rb +33 -72
  49. data/lib/w3c_api/models/{translations.rb → translation_index.rb} +5 -11
  50. data/lib/w3c_api/models/user.rb +95 -165
  51. data/lib/w3c_api/models/user_index.rb +11 -0
  52. data/lib/w3c_api/models.rb +36 -12
  53. data/lib/w3c_api/version.rb +1 -1
  54. data/lib/w3c_api.rb +3 -2
  55. metadata +38 -19
  56. data/lib/w3c_api/models/affiliations.rb +0 -33
  57. data/lib/w3c_api/models/base.rb +0 -39
  58. data/lib/w3c_api/models/call_for_translation_ref.rb +0 -15
  59. data/lib/w3c_api/models/charters.rb +0 -17
  60. data/lib/w3c_api/models/collection_base.rb +0 -79
  61. data/lib/w3c_api/models/delegate_enumerable.rb +0 -54
  62. data/lib/w3c_api/models/groups.rb +0 -38
  63. data/lib/w3c_api/models/link.rb +0 -17
  64. data/lib/w3c_api/models/participations.rb +0 -17
  65. data/lib/w3c_api/models/series_collection.rb +0 -17
  66. data/lib/w3c_api/models/spec_versions.rb +0 -17
  67. data/lib/w3c_api/models/specifications.rb +0 -17
  68. data/lib/w3c_api/models/users.rb +0 -44
@@ -1,110 +1,69 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
4
3
  require_relative 'extension'
5
- require_relative 'link'
6
4
 
7
- # Example charter response format - specific fields may vary by group:
5
+ # https://api.w3.org/groups/109735/charters/361
8
6
  # {
9
- # "end": "2025-10-31"
10
- # "title": "Accessibility Guidelines Working Group Charter"
11
- # "start": "1997-10-06"
12
- # "initial_end": "1999-10-06"
13
- # "uri": "https://www.w3.org/2022/05/accessibility-guidelines-wg-charter.html"
14
- # "cfp_uri": "https://lists.w3.org/Archives/Member/w3c-ac-members/..."
15
- # "extensions": [...]
16
- # "required_new_commitments": false
17
- # "patent_policy": "pre-2020"
7
+ # "end": "2020-04-30",
8
+ # "doc-licenses": [],
9
+ # "start": "2018-09-24",
10
+ # "initial-end": "2020-03-01",
11
+ # "uri": "https://www.w3.org/2018/09/immersive-web-wg-charter.html",
12
+ # "cfp-uri": "https://lists.w3.org/Archives/Member/w3c-ac-members/2018JulSep/0053.html",
13
+ # "extensions": [
14
+ # {
15
+ # "end": "2020-04-30",
16
+ # "announcement_uri": "https://lists.w3.org/Archives/Member/w3c-ac-members/2020JanMar/0028.html"
17
+ # }
18
+ # ],
19
+ # "required-new-commitments": true,
20
+ # "patent-policy": "https://www.w3.org/Consortium/Patent-Policy-20170801/",
18
21
  # "_links": {
19
22
  # "self": {
20
- # "href": "https://api.w3.org/groups/wg/ag/charters/492"
23
+ # "href": "https://api.w3.org/groups/wg/immersive-web/charters/361"
21
24
  # },
22
25
  # "group": {
23
- # "href": "https://api.w3.org/groups/wg/ag"
26
+ # "href": "https://api.w3.org/groups/wg/immersive-web",
27
+ # "title": "Immersive Web Working Group"
28
+ # },
29
+ # "next-charter": {
30
+ # "href": "https://api.w3.org/groups/wg/immersive-web/charters/405"
24
31
  # }
25
32
  # }
26
33
  # }
27
34
 
28
35
  module W3cApi
29
- module Models
30
- class CharterLinks < Lutaml::Model::Serializable
31
- attribute :self, Link
32
- attribute :group, Link
33
- end
34
-
35
- class Charter < Base
36
- attribute :end, :string # Date-time format
37
- attribute :href, :string
38
- attribute :title, :string
39
- attribute :start, :string # Date-time format
40
- attribute :initial_end, :string # Date-time format
41
- attribute :uri, :string, pattern: %r{https?://www\.w3\.org.*}
42
- attribute :cfp_uri, :string, pattern: %r{https://lists\.w3\.org/Archives/Member/w3c-ac-members/.*}
43
- attribute :extensions, Extension, collection: true
44
- attribute :required_new_commitments, :boolean
45
- attribute :patent_policy, :string
46
- attribute :_links, CharterLinks
47
-
48
- # Return the group this charter belongs to
49
- def group(client = nil)
50
- return nil unless client && _links&.group
51
-
52
- group_href = _links.group.href
53
- group_id = group_href.split('/').last
54
-
55
- client.group(group_id)
56
- end
57
-
58
- # Parse date strings to Date objects
59
- def end_date
60
- Date.parse(self.end) if self.end
61
- rescue Date::Error
62
- nil
63
- end
64
-
65
- def start_date
66
- Date.parse(start) if start
67
- rescue Date::Error
68
- nil
69
- end
70
-
71
- def initial_end_date
72
- Date.parse(initial_end) if initial_end
73
- rescue Date::Error
74
- nil
75
- end
76
-
77
- # Check if this charter is active
78
- def active?
79
- start_date &&
80
- (end_date.nil? || end_date >= Date.today) &&
81
- start_date <= Date.today
82
- rescue Date::Error
83
- false
84
- end
85
-
86
- # Check if this charter has been extended
87
- def extended?
88
- !extensions.nil? && !extensions.empty?
89
- end
36
+ module Models
37
+ class Charter < Lutaml::Hal::Resource
38
+ attribute :end, :date_time
39
+ attribute :doc_licenses, :string, collection: true
40
+ attribute :start, :date_time
41
+ attribute :initial_end, :date_time
42
+ attribute :uri, :string
43
+ attribute :cfp_uri, :string
44
+ attribute :extensions, Extension, collection: true
45
+ attribute :required_new_commitments, :boolean
46
+ attribute :patent_policy, :string
90
47
 
91
- def self.from_response(response)
92
- transformed_response = transform_keys(response)
48
+ hal_link :self, key: 'self', realize_class: 'Charter'
49
+ hal_link :group, key: 'group', realize_class: 'Group'
50
+ hal_link :next_charter, key: 'next-charter', realize_class: 'Charter'
93
51
 
94
- charter = new
95
- transformed_response.each do |key, value|
96
- case key
97
- when :_links
98
- links = value.each_with_object({}) do |(link_name, link_data), acc|
99
- acc[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
100
- end
101
- charter._links = CharterLinks.new(links)
102
- else
103
- charter.send("#{key}=", value) if charter.respond_to?("#{key}=")
104
- end
52
+ key_value do
53
+ %i[
105
54
  end
106
- charter
55
+ doc_licenses
56
+ start
57
+ initial_end
58
+ uri
59
+ cfp_uri
60
+ extensions
61
+ required_new_commitments
62
+ patent_policy
63
+ ].each do |key|
64
+ map key.to_s.tr('_', '-'), to: key
107
65
  end
108
66
  end
109
67
  end
68
+ end
110
69
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'charter'
4
+
5
+ module W3cApi
6
+ module Models
7
+ class CharterIndex < Lutaml::Hal::Page
8
+ hal_link :charters, key: 'charters', realize_class: 'Charter', collection: true
9
+ end
10
+ end
11
+ end
@@ -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
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'specification_index'
4
+
5
+ module W3cApi
6
+ module Models
7
+ # Manual GroupLinkSet class to fix collection issue
8
+ class GroupLinkSet < Lutaml::Hal::LinkSet
9
+ # Define the specifications attribute with collection: true
10
+ # This is needed because the Group model's specifications link
11
+ # realizes to a SpecificationIndex which contains a collection
12
+ attribute :specifications, SpecificationIndexLink, collection: true
13
+
14
+ key_value do
15
+ map 'specifications', to: :specifications
16
+ end
17
+ end
18
+
19
+ # Define the link class for SpecificationIndex
20
+ class SpecificationIndexLink < Lutaml::Hal::Link
21
+ attribute :type, :string, default: 'SpecificationIndex'
22
+ end
23
+ end
24
+ 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