Top Level Namespace

Defined Under Namespace

Modules: Enumerable, RTR, RememberTheRuby Classes: DateTime, Fixnum, NilClass, String

Instance Method Summary collapse

Instance Method Details

#apiObject



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rtr/api.rb', line 1

def api
  
  @api ||= begin

    api = RememberTheRuby::API.new(:frob  => $storage[:frob], 
                                   :token => $storage[:token])

    unless $storage[:frob]
      system %{open "#{api.authorization_url}"}
      $storage[:frob] = api.frob
      exit
    end

    unless $storage[:token]
      $storage[:token] = api.authenticate
    end
  
    api

  end
  
end

#register_method(method, &blk) ⇒ Object



3
4
5
# File 'lib/rtr/command_helper.rb', line 3

def register_method(method, &blk)
  $methods[method] = blk
end

#usage_and_exitObject



7
8
9
10
# File 'lib/rtr/command_helper.rb', line 7

def usage_and_exit
  puts "usage: rtr <command> [options]"
  exit 1
end