Class: TwDo::API

Inherits:
Object
  • Object
show all
Includes:
OAuth::CLI::Twitter
Defined in:
lib/twdo/api.rb

Constant Summary collapse

CONF =
ENV['HOME'] + '/.twdo'
CONSUMER_TOKEN =
'Tok5taGUA8x3VE60w79Q'
CONSUMER_SECRET =
'qf2UedjS1A9wEqMure0wrq03wWpl4qvAyiCp0dLMd8Q'

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ API

Returns a new instance of API.



15
16
17
18
19
20
# File 'lib/twdo/api.rb', line 15

def initialize(*args)
  @access_token = get_access_token(:file => CONF)
  oauth = ::Twitter::OAuth.new(CONSUMER_TOKEN, CONSUMER_SECRET)
  oauth.authorize_from_access(@access_token.token, @access_token.secret)
  @twitter = ::Twitter::Base.new(oauth)
end

Instance Method Details

#getObject



22
23
24
# File 'lib/twdo/api.rb', line 22

def get
  @twitter.user(@access_token.params[:screen_name]).description
end

#set(val) ⇒ Object



26
27
28
# File 'lib/twdo/api.rb', line 26

def set(val)
  @twitter.update_profile(:description => val)
end