Class: TwDo::API
- Inherits:
-
Object
- Object
- TwDo::API
- 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
- #get ⇒ Object
-
#initialize(*args) ⇒ API
constructor
A new instance of API.
- #set(val) ⇒ Object
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.(@access_token.token, @access_token.secret) @twitter = ::Twitter::Base.new(oauth) end |
Instance Method Details
#get ⇒ Object
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 |