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,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'lutaml/model'
4
- require_relative 'translation'
5
- require_relative 'delegate_enumerable'
6
- require_relative 'collection_base'
7
-
8
3
  # {
9
4
  # "page"=>1,
10
5
  # "limit"=>100,
@@ -29,12 +24,9 @@ require_relative 'collection_base'
29
24
  # },
30
25
 
31
26
  module W3cApi
32
- module Models
33
- class Translations < CollectionBase
34
- attribute :translations, Translation, collection: true
35
-
36
- delegate_enumerable :translations
37
- collection_instance_class Translation, :translations
38
- end
27
+ module Models
28
+ class TranslationIndex < Lutaml::Hal::Page
29
+ hal_link :translations, key: 'translations', realize_class: 'Translation', collection: true
39
30
  end
31
+ end
40
32
  end
@@ -1,178 +1,108 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base'
4
- require_relative 'connected_account'
5
- require_relative 'link'
6
-
3
+ # https://api.w3.org/users/f1of1ovb5rydm8s0go04oco0cgk0sow44w
7
4
  # {
8
- # "id"=>58291,
9
- # "name"=>"David Grogan",
10
- # "given"=>"David",
11
- # "family"=>"Grogan",
12
- # "work-title"=>"Software Engineer",
13
- # "connected-accounts"=>[
14
- # {
15
- # "created"=>"2019-07-18T21:28:31+00:00",
16
- # "updated"=>"2021-01-21T10:49:57+00:00",
17
- # "service"=>"github",
18
- # "identifier"=>"1801875",
19
- # "nickname"=>"davidsgrogan",
20
- # "profile-picture"=>"https://avatars.githubusercontent.com/u/1801875?v=4",
21
- # "href"=>"https://github.com/davidsgrogan",
22
- # "_links"=>{
23
- # "user"=>{
24
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8"
5
+ # "id": 128112,
6
+ # "name": "Jennifer Strickland",
7
+ # "given": "Jennifer",
8
+ # "family": "Strickland",
9
+ # "country-code": "US",
10
+ # "connected-accounts": [
11
+ # {
12
+ # "created": "2021-03-12T22:06:06+00:00",
13
+ # "service": "github",
14
+ # "identifier": "57469",
15
+ # "nickname": "jenstrickland",
16
+ # "profile-picture": "https://avatars.githubusercontent.com/u/57469?v=4",
17
+ # "href": "https://github.com/jenstrickland",
18
+ # "_links": {
19
+ # "user": {
20
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w"
21
+ # }
22
+ # }
23
+ # }
24
+ # ],
25
+ # "discr": "user",
26
+ # "_links": {
27
+ # "self": {
28
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w"
29
+ # },
30
+ # "affiliations": {
31
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/affiliations"
32
+ # },
33
+ # "groups": {
34
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/groups"
35
+ # },
36
+ # "specifications": {
37
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/specifications"
38
+ # },
39
+ # "photos": [
40
+ # {
41
+ # "href": "https://www.w3.org/thumbnails/360/avatar-images/f1ovb5rydm8s0go04oco0cgk0sow44w.webp?x-version=3",
42
+ # "name": "large"
43
+ # },
44
+ # {
45
+ # "href": "https://www.w3.org/thumbnails/100/avatar-images/f1ovb5rydm8s0go04oco0cgk0sow44w.webp?x-version=3",
46
+ # "name": "thumbnail"
47
+ # },
48
+ # {
49
+ # "href": "https://www.w3.org/thumbnails/48/avatar-images/f1ovb5rydm8s0go04oco0cgk0sow44w.webp?x-version=3",
50
+ # "name": "tiny"
51
+ # }
52
+ # ],
53
+ # "participations": {
54
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/participations"
55
+ # },
56
+ # "chair_of_groups": {
57
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/chair-of-groups"
58
+ # },
59
+ # "team_contact_of_groups": {
60
+ # "href": "https://api.w3.org/users/f1ovb5rydm8s0go04oco0cgk0sow44w/team-contact-of-groups"
25
61
  # }
26
- # }
27
- # }
28
- # ],
29
- # "discr"=>"user",
30
- # "_links"=>{
31
- # "self"=>{
32
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8"
33
- # },
34
- # "affiliations"=>{
35
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/affiliations"
36
- # },
37
- # "groups"=>{
38
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/groups"
39
- # },
40
- # "specifications"=>{
41
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/specifications"
42
- # },
43
- # "participations"=>{
44
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/participations"
45
- # },
46
- # "chair_of_groups"=>{
47
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/chair-of-groups"
48
- # },
49
- # "team_contact_of_groups"=>{
50
- # "href"=>"https://api.w3.org/users/c2yerd5euz48gcw08s44oww8g4oo8w8/team-contact-of-groups"
51
62
  # }
52
- # }
53
63
  # }
54
64
 
55
- # {
56
- # "id": 40757,
57
- # "name": "Stéphane Deschamps",
58
- # "given": "Stéphane",
59
- # "family": "Deschamps",
60
- # "work_title": "Mr.",
61
- # "discr": "user",
62
- # "biography": "I love accessibility and standards. Don't we all.",
63
- # "country_code": "FR",
64
- # "city": "Arcueil Cedex",
65
- # "_links": {
66
- # "self": {
67
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008"
68
- # },
69
- # "affiliations": {
70
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/affiliations"
71
- # },
72
- # "groups": {
73
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/groups"
74
- # },
75
- # "specifications": {
76
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/specifications"
77
- # },
78
- # "participations": {
79
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/participations"
80
- # },
81
- # "chair_of_groups": {
82
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/chair-of-groups"
83
- # },
84
- # "team_contact_of_groups": {
85
- # "href": "https://api.w3.org/users/56nw1z8a5uo0sscsgk4kso8g0004008/team-contact-of-groups"
86
- # }
87
- # }
88
- # }
65
+ require_relative 'account'
66
+ require_relative 'photo'
89
67
 
90
68
  module W3cApi
91
- module Models
92
- class UserPhoto < Lutaml::Model::Serializable
93
- attribute :href, :string
94
- attribute :name, :string
95
- end
96
-
97
- class UserLinks < Lutaml::Model::Serializable
98
- attribute :self, Link
99
- attribute :affiliations, Link
100
- attribute :groups, Link
101
- attribute :specifications, Link
102
- attribute :participations, Link
103
- attribute :chair_of_groups, Link
104
- attribute :team_contact_of_groups, Link
105
- end
106
-
107
- class User < Base
108
- attribute :id, :integer
109
- attribute :href, :string
110
- attribute :title, :string
111
- attribute :name, :string
112
- attribute :email, :string
113
- attribute :given, :string
114
- attribute :family, :string
115
- attribute :work_title, :string
116
- attribute :discr, :string
117
- attribute :biography, :string
118
- attribute :phone, :string
119
- attribute :country_code, :string
120
- attribute :country_division, :string
121
- attribute :city, :string
122
- attribute :connected_accounts, ConnectedAccount, collection: true
123
- attribute :_links, UserLinks
124
-
125
- # Return groups this user is a member of
126
- def groups(client = nil)
127
- return nil unless client && _links&.groups
128
-
129
- client.user_groups(id)
130
- end
131
-
132
- # Return specifications this user has contributed to
133
- def specifications(client = nil)
134
- return nil unless client && _links&.specifications
135
-
136
- client.user_specifications(id)
137
- end
138
-
139
- def self.from_response(response)
140
- transformed_response = transform_keys(response)
141
-
142
- user = new
143
- transformed_response.each do |key, value|
144
- case key
145
- when :connected_accounts
146
- user.connected_accounts = value.map do |account|
147
- ConnectedAccount.from_response(account)
148
- end
149
- when :_links
150
- links_data = {}
151
-
152
- # Handle all standard links
153
- value.each do |link_name, link_data|
154
- next if link_name == :photos
155
-
156
- # Handle photos array separately
157
-
158
- links_data[link_name] = Link.new(href: link_data[:href], title: link_data[:title])
159
- end
160
-
161
- # Handle photos if present
162
- if value[:photos]
163
- photos = value[:photos].map do |photo|
164
- UserPhoto.new(href: photo[:href], name: photo[:name])
165
- end
166
- links_data[:photos] = photos
167
- end
168
-
169
- user._links = UserLinks.new(links_data)
170
- else
171
- user.send("#{key}=", value) if user.respond_to?("#{key}=")
172
- end
173
- end
174
- user
69
+ module Models
70
+ # User model representing a W3C user/participant
71
+ class User < Lutaml::Hal::Resource
72
+ attribute :id, :string
73
+ attribute :name, :string
74
+ attribute :link, :string
75
+ attribute :given, :string
76
+ attribute :family, :string
77
+ attribute :discr, :string
78
+ attribute :country_code, :string
79
+ attribute :connected_accounts, Account, collection: true
80
+ attribute :photos, Photo, collection: true
81
+
82
+ hal_link :self, key: 'self', realize_class: 'User'
83
+ hal_link :affiliations, key: 'affiliations', realize_class: 'AffiliationIndex'
84
+ hal_link :groups, key: 'groups', realize_class: 'GroupIndex'
85
+ hal_link :specifications, key: 'specifications', realize_class: 'SpecificationIndex'
86
+ hal_link :participations, key: 'participations', realize_class: 'ParticipationIndex'
87
+ hal_link :chair_of_groups, key: 'chair-of-groups', realize_class: 'GroupIndex'
88
+ hal_link :team_contact_of_groups, key: 'team-contact-of-groups', realize_class: 'GroupIndex'
89
+ hal_link :photos, key: 'photos', realize_class: 'Photo', collection: true
90
+
91
+ key_value do
92
+ %i[
93
+ id
94
+ name
95
+ link
96
+ given
97
+ family
98
+ discr
99
+ country_code
100
+ connected_accounts
101
+ photos
102
+ ].each do |key|
103
+ map key.to_s.tr('_', '-'), to: key
175
104
  end
176
105
  end
177
106
  end
107
+ end
178
108
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'user'
4
+
5
+ module W3cApi
6
+ module Models
7
+ class UserIndex < Lutaml::Hal::Page
8
+ hal_link :users, key: 'users', realize_class: 'User', collection: true
9
+ end
10
+ end
11
+ end
@@ -1,15 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module W3cApi
2
- module Models
3
- end
4
+ module Models
5
+ end
4
6
  end
5
7
 
6
- require_relative 'models/specifications'
7
- require_relative 'models/spec_versions'
8
- require_relative 'models/users'
9
- require_relative 'models/charters'
10
- require_relative 'models/translations'
11
- require_relative 'models/series_collection'
12
- require_relative 'models/affiliations'
13
- require_relative 'models/participations'
14
- require_relative 'models/groups'
15
- require_relative 'models/ecosystems'
8
+ # Load specific model implementations
9
+ require_relative 'models/affiliation'
10
+ require_relative 'models/affiliation_index'
11
+ require_relative 'models/call_for_translation'
12
+ require_relative 'models/charter'
13
+ require_relative 'models/charter_index'
14
+ require_relative 'models/chair_index'
15
+ require_relative 'models/connected_account'
16
+ require_relative 'models/ecosystem'
17
+ require_relative 'models/ecosystem_index'
18
+ require_relative 'models/evangelist_index'
19
+ require_relative 'models/extension'
20
+ require_relative 'models/group'
21
+ require_relative 'models/group_index'
22
+ require_relative 'models/join_emails'
23
+ require_relative 'models/participant_index'
24
+ require_relative 'models/participation'
25
+ require_relative 'models/participation_index'
26
+ require_relative 'models/serie'
27
+ require_relative 'models/serie_index'
28
+ require_relative 'models/spec_version'
29
+ require_relative 'models/spec_version_index'
30
+ require_relative 'models/spec_version_ref'
31
+ require_relative 'models/specification'
32
+ require_relative 'models/specification_index'
33
+ require_relative 'models/team_contact_index'
34
+ require_relative 'models/testimonial'
35
+ require_relative 'models/translation'
36
+ require_relative 'models/translation_index'
37
+ require_relative 'models/user'
38
+ require_relative 'models/user_index'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module W3cApi
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.1'
5
5
  end
data/lib/w3c_api.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module W3cApi
4
- end
3
+ require 'lutaml/model'
4
+ require 'lutaml/hal'
5
5
 
6
6
  require_relative 'w3c_api/version'
7
+ require_relative 'w3c_api/hal'
7
8
  require_relative 'w3c_api/models'
8
9
  require_relative 'w3c_api/client'
9
10
  require_relative 'w3c_api/cli'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: w3c_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2025-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lutaml-hal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: lutaml-model
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +67,7 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: terminal-table
70
+ name: rainbow
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -104,38 +118,40 @@ files:
104
118
  - lib/w3c_api/commands/specification.rb
105
119
  - lib/w3c_api/commands/translation.rb
106
120
  - lib/w3c_api/commands/user.rb
121
+ - lib/w3c_api/hal.rb
107
122
  - lib/w3c_api/models.rb
123
+ - lib/w3c_api/models/account.rb
108
124
  - lib/w3c_api/models/affiliation.rb
109
- - lib/w3c_api/models/affiliations.rb
110
- - lib/w3c_api/models/base.rb
125
+ - lib/w3c_api/models/affiliation_index.rb
111
126
  - lib/w3c_api/models/call_for_translation.rb
112
- - lib/w3c_api/models/call_for_translation_ref.rb
127
+ - lib/w3c_api/models/chair_index.rb
113
128
  - lib/w3c_api/models/charter.rb
114
- - lib/w3c_api/models/charters.rb
115
- - lib/w3c_api/models/collection_base.rb
129
+ - lib/w3c_api/models/charter_index.rb
116
130
  - lib/w3c_api/models/connected_account.rb
117
- - lib/w3c_api/models/delegate_enumerable.rb
118
131
  - lib/w3c_api/models/ecosystem.rb
119
- - lib/w3c_api/models/ecosystems.rb
132
+ - lib/w3c_api/models/ecosystem_index.rb
133
+ - lib/w3c_api/models/evangelist_index.rb
120
134
  - lib/w3c_api/models/extension.rb
121
135
  - lib/w3c_api/models/group.rb
122
- - lib/w3c_api/models/groups.rb
136
+ - lib/w3c_api/models/group_index.rb
123
137
  - lib/w3c_api/models/join_emails.rb
124
- - lib/w3c_api/models/link.rb
138
+ - lib/w3c_api/models/participant_index.rb
125
139
  - lib/w3c_api/models/participation.rb
126
- - lib/w3c_api/models/participations.rb
140
+ - lib/w3c_api/models/participation_index.rb
141
+ - lib/w3c_api/models/photo.rb
127
142
  - lib/w3c_api/models/serie.rb
128
- - lib/w3c_api/models/series.rb
129
- - lib/w3c_api/models/series_collection.rb
143
+ - lib/w3c_api/models/serie_index.rb
130
144
  - lib/w3c_api/models/spec_version.rb
145
+ - lib/w3c_api/models/spec_version_index.rb
131
146
  - lib/w3c_api/models/spec_version_ref.rb
132
- - lib/w3c_api/models/spec_versions.rb
133
147
  - lib/w3c_api/models/specification.rb
134
- - lib/w3c_api/models/specifications.rb
148
+ - lib/w3c_api/models/specification_index.rb
149
+ - lib/w3c_api/models/team_contact_index.rb
150
+ - lib/w3c_api/models/testimonial.rb
135
151
  - lib/w3c_api/models/translation.rb
136
- - lib/w3c_api/models/translations.rb
152
+ - lib/w3c_api/models/translation_index.rb
137
153
  - lib/w3c_api/models/user.rb
138
- - lib/w3c_api/models/users.rb
154
+ - lib/w3c_api/models/user_index.rb
139
155
  - lib/w3c_api/version.rb
140
156
  homepage: https://github.com/relaton/w3c-api
141
157
  licenses:
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lutaml/model'
4
- require_relative 'affiliation'
5
- require_relative 'delegate_enumerable'
6
- require_relative 'collection_base'
7
-
8
- # {
9
- # "page"=>1,
10
- # "limit"=>1000,
11
- # "pages"=>16,
12
- # "total"=>15918,
13
- # "_links"=>{
14
- # "affiliations"=>[
15
- # {
16
- # "href"=>"https://api.w3.org/affiliations/1001",
17
- # "title"=>"Framkom (Forskningsaktiebolaget Medie-och Kommunikationsteknik)"
18
- # },
19
- # {
20
- # "href"=>"https://api.w3.org/affiliations/1003",
21
- # "title"=>"BackWeb Technologies, Inc."
22
- # },
23
-
24
- module W3cApi
25
- module Models
26
- class Affiliations < CollectionBase
27
- attribute :affiliations, Affiliation, collection: true
28
-
29
- delegate_enumerable :affiliations
30
- collection_instance_class Affiliation, :affiliations
31
- end
32
- end
33
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lutaml/model'
4
- require 'json'
5
- require 'yaml'
6
-
7
- module W3cApi
8
- module Models
9
- class Base < Lutaml::Model::Serializable
10
- # Common methods for all W3C API models
11
-
12
- # Create a model instance from a JSON hash
13
- def self.from_response(data)
14
- # Convert keys with hyphens to snake_case for Ruby
15
- transformed_data = transform_keys(data)
16
-
17
- # Create model instance
18
- new(transformed_data)
19
- end
20
-
21
- # Utility function to transform kebab-case to snake_case
22
- def self.transform_keys(data)
23
- case data
24
- when Hash
25
- result = {}
26
- data.each do |key, value|
27
- snake_key = key.to_s.tr('-', '_').to_sym
28
- result[snake_key] = transform_keys(value)
29
- end
30
- result
31
- when Array
32
- data.map { |item| transform_keys(item) }
33
- else
34
- data
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lutaml/model'
4
- require_relative 'spec_version_ref'
5
-
6
- module W3cApi
7
- module Models
8
- class CallForTranslationRef < Lutaml::Model::Serializable
9
- attribute :uri, :string
10
- attribute :title, :string
11
- attribute :comments, :string
12
- attribute :spec_version, SpecVersionRef
13
- end
14
- end
15
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'lutaml/model'
4
- require_relative 'charter'
5
- require_relative 'delegate_enumerable'
6
- require_relative 'collection_base'
7
-
8
- module W3cApi
9
- module Models
10
- class Charters < CollectionBase
11
- attribute :charters, Charter, collection: true
12
-
13
- delegate_enumerable :charters
14
- collection_instance_class Charter, :charters
15
- end
16
- end
17
- end