Class: W3cApi::Commands::Affiliation

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

Overview

Thor CLI command for affiliation operations

Instance Method Summary collapse

Methods included from OutputFormatter

#output_results

Instance Method Details

#fetchObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/w3c_api/commands/affiliation.rb', line 17

def fetch
  client = W3cApi::Client.new

  affiliations = if options[:id]
                   # Single affiliation
                   client.affiliation(options[:id])
                 else
                   client.affiliations
                 end

  output_results(affiliations, options[:format])
end

#participantsObject



34
35
36
37
38
# File 'lib/w3c_api/commands/affiliation.rb', line 34

def participants
  client = W3cApi::Client.new
  participants = client.affiliation_participants(options[:id])
  output_results(participants, options[:format])
end

#participationsObject



44
45
46
47
48
# File 'lib/w3c_api/commands/affiliation.rb', line 44

def participations
  client = W3cApi::Client.new
  participations = client.affiliation_participations(options[:id])
  output_results(participations, options[:format])
end