Class: W3cApi::Commands::Series

Inherits:
Thor
  • Object
show all
Includes:
OutputFormatter, UserAgentOption
Defined in:
lib/w3c_api/commands/series.rb

Overview

Thor CLI command for series operations

Instance Method Summary collapse

Methods included from UserAgentOption

included, #initialize

Methods included from OutputFormatter

#output_results

Instance Method Details

#fetchObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/w3c_api/commands/series.rb', line 19

def fetch
  client = W3cApi::Client.new

  series = if options[:shortname]
             # Single series
             client.series_by_shortname(options[:shortname])
           else
             # All series
             client.series
           end

  output_results(series, options[:format])
end

#specificationsObject



37
38
39
40
41
# File 'lib/w3c_api/commands/series.rb', line 37

def specifications
  client = W3cApi::Client.new
  specifications = client.series_specifications(options[:shortname])
  output_results(specifications, options[:format])
end