Class: Yacs::Cli::Command

Inherits:
Thor
  • Object
show all
Defined in:
lib/yacs/cli.rb

Constant Summary collapse

COURSE_API_OPTIONS =
%w(id name number department_code department_id search)
SECTION_API_OPTIONS =
%w(id name crn instructors course_id)
SYSTEM_OPTIONS =
%w(v q)

Instance Method Summary collapse

Instance Method Details

#courseObject



16
17
18
19
20
21
22
23
24
# File 'lib/yacs/cli.rb', line 16

def course
  courses = Yacs::Client.new.courses(options)
  fields = %w(id)
  unless options['q']
    fields << 'name'
    fields << 'description' if options['v']
  end
  Printer.print courses, fields
end

#sectionObject



29
30
31
32
33
34
35
36
# File 'lib/yacs/cli.rb', line 29

def section
  sections = Yacs::Client.new.sections(options)
  fields = %w(id)
  unless options['q']
    fields.concat %w(name crn instructors seats_taken seats)
  end
  Printer.print sections, fields
end