Class: W3cApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/w3c_api/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.embed_supported_endpointsObject

Class method to list endpoints that support embed parameter



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/w3c_api/client.rb', line 11

def self.embed_supported_endpoints
  hal_instance = W3cApi::Hal.instance
  endpoints_with_embed = []

  hal_instance.register.models.each do |endpoint_id, endpoint_config|
    # Check if this endpoint has embed parameter support
    has_embed = endpoint_config[:parameters].any? do |param|
      param.name == "embed" && param.location == :query
    end

    endpoints_with_embed << endpoint_id if has_embed
  end

  endpoints_with_embed.sort
end

Instance Method Details

#affiliation(id, options = {}) ⇒ Object



137
138
139
# File 'lib/w3c_api/client.rb', line 137

def affiliation(id, options = {})
  fetch_resource(:affiliation_resource, id: id, **options)
end

#affiliations(options = {}) ⇒ Object

Affiliation methods



133
134
135
# File 'lib/w3c_api/client.rb', line 133

def affiliations(options = {})
  fetch_resource(:affiliation_index, **options)
end

#ecosystem(shortname, options = {}) ⇒ Object



152
153
154
# File 'lib/w3c_api/client.rb', line 152

def ecosystem(shortname, options = {})
  fetch_resource(:ecosystem_resource, shortname: shortname, **options)
end

#ecosystems(options = {}) ⇒ Object

Ecosystem methods



148
149
150
# File 'lib/w3c_api/client.rb', line 148

def ecosystems(options = {})
  fetch_resource(:ecosystem_index, **options)
end

#embed_supported?(endpoint_id) ⇒ Boolean

Instance method to check if a specific endpoint supports embed

Returns:

  • (Boolean)


28
29
30
# File 'lib/w3c_api/client.rb', line 28

def embed_supported?(endpoint_id)
  self.class.embed_supported_endpoints.include?(endpoint_id)
end

#group(id, options = {}) ⇒ Object



100
101
102
# File 'lib/w3c_api/client.rb', line 100

def group(id, options = {})
  fetch_resource(:group_resource, id: id, **options)
end

#groups(options = {}) ⇒ Object

Group methods



96
97
98
# File 'lib/w3c_api/client.rb', line 96

def groups(options = {})
  fetch_resource(:group_index, **options)
end

#participation(id, options = {}) ⇒ Object

Participation methods



164
165
166
# File 'lib/w3c_api/client.rb', line 164

def participation(id, options = {})
  fetch_resource(:participation_resource, id: id, **options)
end

#participation_participants(id, options = {}) ⇒ Object



168
169
170
# File 'lib/w3c_api/client.rb', line 168

def participation_participants(id, options = {})
  fetch_resource(:participation_participants_index, id: id, **options)
end

#series(options = {}) ⇒ Object

Series methods



77
78
79
# File 'lib/w3c_api/client.rb', line 77

def series(options = {})
  fetch_resource(:serie_index, **options)
end

#series_by_shortname(shortname, options = {}) ⇒ Object



81
82
83
# File 'lib/w3c_api/client.rb', line 81

def series_by_shortname(shortname, options = {})
  fetch_resource(:serie_resource, shortname: shortname, **options)
end

#series_current_specification(shortname, options = {}) ⇒ Object



90
91
92
93
# File 'lib/w3c_api/client.rb', line 90

def series_current_specification(shortname, options = {})
  fetch_resource(:serie_current_specification_resource,
                 shortname: shortname, **options)
end

#series_specifications(shortname, options = {}) ⇒ Object



85
86
87
88
# File 'lib/w3c_api/client.rb', line 85

def series_specifications(shortname, options = {})
  fetch_resource(:serie_specification_resource,
                 shortname: shortname, **options)
end

#specification(shortname, options = {}) ⇒ Object



37
38
39
# File 'lib/w3c_api/client.rb', line 37

def specification(shortname, options = {})
  fetch_resource(:specification_resource, shortname: shortname, **options)
end

#specification_version(shortname, version, options = {}) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/w3c_api/client.rb', line 46

def specification_version(shortname, version, options = {})
  fetch_resource(
    :specification_resource_version_resource,
    shortname: shortname,
    version: version,
    **options,
  )
end

#specification_version_deliverers(shortname, version, options = {}) ⇒ Object



71
72
73
74
# File 'lib/w3c_api/client.rb', line 71

def specification_version_deliverers(shortname, version, options = {})
  fetch_resource(:specification_version_deliverers_index,
                 shortname: shortname, version: version, **options)
end

#specification_version_editors(shortname, version, options = {}) ⇒ Object



66
67
68
69
# File 'lib/w3c_api/client.rb', line 66

def specification_version_editors(shortname, version, options = {})
  fetch_resource(:specification_version_editors_index,
                 shortname: shortname, version: version, **options)
end

#specification_versions(shortname, options = {}) ⇒ Object



41
42
43
44
# File 'lib/w3c_api/client.rb', line 41

def specification_versions(shortname, options = {})
  fetch_resource(:specification_resource_version_index,
                 shortname: shortname, **options)
end

#specifications(options = {}) ⇒ Object

Specification methods



33
34
35
# File 'lib/w3c_api/client.rb', line 33

def specifications(options = {})
  fetch_resource(:specification_index, **(options || {}))
end

#specifications_by_status(status, options = {}) ⇒ Object



55
56
57
# File 'lib/w3c_api/client.rb', line 55

def specifications_by_status(status, options = {})
  fetch_resource(:specification_by_status_index, status: status, **options)
end

#translation(id, options = {}) ⇒ Object



128
129
130
# File 'lib/w3c_api/client.rb', line 128

def translation(id, options = {})
  fetch_resource(:translation_resource, id: id, **options)
end

#translations(options = {}) ⇒ Object

Translation methods



124
125
126
# File 'lib/w3c_api/client.rb', line 124

def translations(options = {})
  fetch_resource(:translation_index, **options)
end

#user(hash, options = {}) ⇒ Object

User methods



112
113
114
# File 'lib/w3c_api/client.rb', line 112

def user(hash, options = {})
  fetch_resource(:user_resource, hash: hash, **options)
end