Sha256: 1a43337b80a72d57b5e69de2498c9a56cf2eefa1e946e11bf3f19b240570940e

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'thor'
require 'redlink'
require 'redlink/endpoint'

module Redlink
  class Cli < Thor
    desc 'init TOKEN', 'Stores the app token for your Redlink application'
    def init(token)
      Redlink::Configuration.app_token = token
    end

    desc 'login USERNAME PASSWORD', 'sign in'
    def login(username, password)
      Redlink::Endpoint.login(username, password)
    end

    desc 'logout', 'srsly'
    def logout
      Redlink::Endpoint.logout
    end

    desc 'locations', 'places'
    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

    desc 'operations', 'wfasd'
    def operations
      p Redlink::Endpoint.endpoint_client.operations
    end

    desc 'session_id SESSION_ID', 'blah'
    def session_id(session_id)
      Redlink::Configuration.session_id = session_id
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redlink-0.1.0 lib/redlink/cli.rb