Class: Tumblr::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/tumblr-follow.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Account

Returns a new instance of Account.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tumblr-follow.rb', line 11

def initialize(opts = {})
  @api_key    = Tumblr::api_key
  @api_secret = Tumblr::api_secret
  @oauth_token  = opts.fetch(:oauth_token)
  @oauth_secret = opts.fetch(:oauth_secret)

  @consumer = OAuth::Consumer.new(@api_key,
                                  @api_secret,
                                  site: "http://www.tumblr.com")
  @access_token = OAuth::AccessToken.new(@consumer, @oauth_token, @oauth_secret)
end

Instance Method Details

#follow!(username) ⇒ Object



23
24
25
# File 'lib/tumblr-follow.rb', line 23

def follow!(username)
  post('/v2/user/follow', url: "#{username}.tumblr.com")
end