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



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

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



32
33
34
35
36
# File 'lib/w3c_api/commands/affiliation.rb', line 32

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

#participationsObject



41
42
43
44
45
# File 'lib/w3c_api/commands/affiliation.rb', line 41

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