Class: Yadokari::CLI

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

Instance Method Summary collapse

Instance Method Details

#cal(yado) ⇒ Object



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

def cal(yado)
  schedules = Yadokari::Schedule.new(yado_id(yado)).list
  schedules.each do |schedule|
    puts "#{schedule['started_on']} ~ #{schedule['finished_on']} #{schedule['schedule']}"
  end
end

#listObject



12
13
14
15
16
17
# File 'lib/yadokari/cli.rb', line 12

def list
  yado = Yadokari::Yado.new
  yado.list.each do |yado|
    puts "#{yado['id']}. #{yado['name']}"
  end
end

#me(token) ⇒ Object



45
46
47
48
# File 'lib/yadokari/cli.rb', line 45

def me(token)
  me = Yadokari::Me.new(token)
  me.run
end

#reserve(yado) ⇒ Object



39
40
41
42
# File 'lib/yadokari/cli.rb', line 39

def reserve(yado)
  reservation = Yadokari::Reservation.new(yado_id(yado))
  reservation.run
end

#show(yado) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/yadokari/cli.rb', line 20

def show(yado)
  yado_information = case yado
                     when 'omishima-space'
                       'https://omishima-space.com/'
                     else
                       'show nothing'
                     end
  puts yado_information
end