Class: Redlink::Cli

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

Instance Method Summary collapse

Instance Method Details

#init(token) ⇒ Object



8
9
10
# File 'lib/redlink/cli.rb', line 8

def init(token)
  Redlink::Configuration.app_token = token
end

#locationsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/redlink/cli.rb', line 23

def locations
  Redlink::Location.all.each do |location|
    s = [location]
    if location.current_weather
      s << location.current_weather
    end

    puts s.join(' - ')

    location.thermostats.each do |thermostat|
      puts "\t#{thermostat}"
    end

  end
end

#login(username, password) ⇒ Object



13
14
15
# File 'lib/redlink/cli.rb', line 13

def (username, password)
  Redlink::Endpoint.(username, password)
end

#logoutObject



18
19
20
# File 'lib/redlink/cli.rb', line 18

def logout
  Redlink::Endpoint.logout
end