Module: W3cApi::Embed

Defined in:
lib/w3c_api/embed.rb

Overview

Module for discovering and working with embed-supported endpoints

Class Method Summary collapse

Class Method Details

.embed_infoObject

Get comprehensive embed information



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/w3c_api/embed.rb', line 27

def embed_info
  {
    supported_endpoints: supported_endpoints,
    descriptions: endpoint_descriptions,
    usage_example: {
      discovery: "W3cApi::Client.embed_supported_endpoints",
      usage: "W3cApi::Client.new.specifications(embed: true, items: 2)",
      automatic_realization: "spec_link.realize  # Uses embedded content automatically",
    },
  }
end

.endpoint_descriptionsObject

Get human-readable descriptions of embed-supported endpoints



18
19
20
21
22
23
24
# File 'lib/w3c_api/embed.rb', line 18

def endpoint_descriptions
  {
    specification_index: "Specifications index with embedded specification details",
    group_index: "Groups index with embedded group details",
    serie_index: "Series index with embedded series details",
  }
end

.supported_endpointsObject

Get list of endpoints that support embed parameter



8
9
10
# File 'lib/w3c_api/embed.rb', line 8

def supported_endpoints
  W3cApi::Client.embed_supported_endpoints
end

.supports_embed?(endpoint_id) ⇒ Boolean

Check if a specific endpoint supports embed

Returns:

  • (Boolean)


13
14
15
# File 'lib/w3c_api/embed.rb', line 13

def supports_embed?(endpoint_id)
  supported_endpoints.include?(endpoint_id.to_sym)
end