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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +40 -0
- data/LICENSE.md +1 -1
- data/README.adoc +1032 -439
- data/Rakefile +7 -3
- data/lib/w3c_api/cli.rb +20 -20
- data/lib/w3c_api/client.rb +57 -237
- data/lib/w3c_api/commands/affiliation.rb +33 -33
- data/lib/w3c_api/commands/ecosystem.rb +47 -47
- data/lib/w3c_api/commands/group.rb +68 -68
- data/lib/w3c_api/commands/output_formatter.rb +11 -11
- data/lib/w3c_api/commands/participation.rb +20 -22
- data/lib/w3c_api/commands/series.rb +26 -26
- data/lib/w3c_api/commands/specification.rb +77 -52
- data/lib/w3c_api/commands/translation.rb +18 -18
- data/lib/w3c_api/commands/user.rb +60 -60
- data/lib/w3c_api/hal.rb +294 -0
- data/lib/w3c_api/models/account.rb +46 -0
- data/lib/w3c_api/models/affiliation.rb +54 -65
- data/lib/w3c_api/models/affiliation_index.rb +11 -0
- data/lib/w3c_api/models/call_for_translation.rb +15 -39
- data/lib/w3c_api/models/chair_index.rb +11 -0
- data/lib/w3c_api/models/charter.rb +48 -89
- data/lib/w3c_api/models/charter_index.rb +11 -0
- data/lib/w3c_api/models/connected_account.rb +21 -30
- data/lib/w3c_api/models/ecosystem.rb +20 -42
- data/lib/w3c_api/models/{ecosystems.rb → ecosystem_index.rb} +4 -10
- data/lib/w3c_api/models/evangelist_index.rb +11 -0
- data/lib/w3c_api/models/extension.rb +5 -7
- data/lib/w3c_api/models/group.rb +63 -142
- data/lib/w3c_api/models/group_index.rb +12 -0
- data/lib/w3c_api/models/group_link_set.rb +24 -0
- data/lib/w3c_api/models/join_emails.rb +5 -7
- data/lib/w3c_api/models/participant_index.rb +11 -0
- data/lib/w3c_api/models/participation.rb +31 -90
- data/lib/w3c_api/models/participation_index.rb +11 -0
- data/lib/w3c_api/models/photo.rb +28 -0
- data/lib/w3c_api/models/serie.rb +21 -51
- data/lib/w3c_api/models/{series.rb → serie_index.rb} +22 -13
- data/lib/w3c_api/models/spec_version.rb +69 -83
- data/lib/w3c_api/models/spec_version_index.rb +14 -0
- data/lib/w3c_api/models/spec_version_ref.rb +11 -13
- data/lib/w3c_api/models/specification.rb +54 -66
- data/lib/w3c_api/models/specification_index.rb +12 -0
- data/lib/w3c_api/models/team_contact_index.rb +11 -0
- data/lib/w3c_api/models/testimonial.rb +19 -0
- data/lib/w3c_api/models/translation.rb +33 -72
- data/lib/w3c_api/models/{translations.rb → translation_index.rb} +5 -11
- data/lib/w3c_api/models/user.rb +95 -165
- data/lib/w3c_api/models/user_index.rb +11 -0
- data/lib/w3c_api/models.rb +36 -12
- data/lib/w3c_api/version.rb +1 -1
- data/lib/w3c_api.rb +3 -2
- metadata +38 -19
- data/lib/w3c_api/models/affiliations.rb +0 -33
- data/lib/w3c_api/models/base.rb +0 -39
- data/lib/w3c_api/models/call_for_translation_ref.rb +0 -15
- data/lib/w3c_api/models/charters.rb +0 -17
- data/lib/w3c_api/models/collection_base.rb +0 -79
- data/lib/w3c_api/models/delegate_enumerable.rb +0 -54
- data/lib/w3c_api/models/groups.rb +0 -38
- data/lib/w3c_api/models/link.rb +0 -17
- data/lib/w3c_api/models/participations.rb +0 -17
- data/lib/w3c_api/models/series_collection.rb +0 -17
- data/lib/w3c_api/models/spec_versions.rb +0 -17
- data/lib/w3c_api/models/specifications.rb +0 -17
- 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
|
-
#
|
5
|
+
# https://api.w3.org/groups/109735/charters/361
|
8
6
|
# {
|
9
|
-
# "end": "
|
10
|
-
# "
|
11
|
-
# "start": "
|
12
|
-
# "
|
13
|
-
# "uri": "https://www.w3.org/
|
14
|
-
# "
|
15
|
-
# "extensions": [
|
16
|
-
#
|
17
|
-
#
|
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/
|
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/
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
92
|
-
|
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
|
-
|
95
|
-
|
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
|
-
|
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
|
@@ -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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
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
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'lutaml/model'
|
4
|
-
|
5
3
|
module W3cApi
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
data/lib/w3c_api/models/group.rb
CHANGED
@@ -1,172 +1,93 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative 'join_emails'
|
5
|
-
require_relative 'link'
|
6
|
-
|
3
|
+
# https://api.w3.org/groups/109735
|
7
4
|
# {
|
8
|
-
# "id":
|
9
|
-
# "name": "
|
10
|
-
# "is_closed": false
|
11
|
-
# "description": "The mission of the
|
12
|
-
# "shortname": "
|
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/
|
17
|
-
# }
|
13
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web"
|
14
|
+
# },
|
18
15
|
# "homepage": {
|
19
|
-
# "href": "https://www.w3.org/
|
20
|
-
# }
|
16
|
+
# "href": "https://www.w3.org/immersive-web/"
|
17
|
+
# },
|
21
18
|
# "users": {
|
22
|
-
# "href": "https://api.w3.org/groups/wg/
|
23
|
-
# }
|
19
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web/users"
|
20
|
+
# },
|
24
21
|
# "services": {
|
25
|
-
# "href": "https://api.w3.org/groups/wg/
|
26
|
-
# }
|
22
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web/services"
|
23
|
+
# },
|
27
24
|
# "specifications": {
|
28
|
-
# "href": "https://api.w3.org/groups/wg/
|
29
|
-
# }
|
25
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web/specifications"
|
26
|
+
# },
|
30
27
|
# "chairs": {
|
31
|
-
# "href": "https://api.w3.org/groups/wg/
|
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/
|
35
|
-
# }
|
31
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web/teamcontacts"
|
32
|
+
# },
|
36
33
|
# "charters": {
|
37
|
-
# "href": "https://api.w3.org/groups/wg/
|
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/
|
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/
|
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/
|
47
|
-
# }
|
43
|
+
# "href": "https://www.w3.org/groups/wg/immersive-web/ipr"
|
44
|
+
# },
|
48
45
|
# "participations": {
|
49
|
-
# "href": "https://api.w3.org/groups/wg/
|
46
|
+
# "href": "https://api.w3.org/groups/wg/immersive-web/participations"
|
50
47
|
# }
|
51
|
-
# }
|
52
|
-
# "type": "working group"
|
53
|
-
# "start-date": "
|
54
|
-
# "end-date": "
|
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
|
-
|
60
|
-
|
61
|
-
attribute :
|
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 :
|
79
|
-
attribute :
|
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
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
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,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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|