Sha256: a1bf9f278351f07df852f52d1a3d9b75f2714d5964c94ad65de1ccc7a65ee6c2

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

class TumblrWrapper::Client
  attr_reader :access_token, :request_token

  def authorize_url
    @request_token = consumer.get_request_token
    @request_token.authorize_url
  end

  def request_access_token(oauth_verifier)
    token = request_token.get_access_token({:oauth_verifier => oauth_verifier})
    @access_token = {
      consumer_key: TumblrWrapper.consumer_key,
      consumer_secret: TumblrWrapper.consumer_secret,
      token: token.token,
      token_secret: token.secret
    }
  end

  def build_request_token(token, secret)
    @request_token = OAuth::RequestToken.new(consumer, token, secret)
  end

  def build_access_token(token, secret)
    @access_token = {
      consumer_key: TumblrWrapper.consumer_key,
      consumer_secret: TumblrWrapper.consumer_secret,
      oauth_token: token,
      oauth_token_secret: secret }
  end

  def consumer
    @consumer ||= OAuth::Consumer.new(
      TumblrWrapper.consumer_key,
      TumblrWrapper.consumer_secret,
      site: 'http://www.tumblr.com'
    )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tumblr_wrapper-0.3.0 lib/tumblr_wrapper/client.rb
tumblr_wrapper-0.2.1 lib/tumblr_wrapper/client.rb
tumblr_wrapper-0.2.0 lib/tumblr_wrapper/client.rb
tumblr_wrapper-0.1.1 lib/tumblr_wrapper/client.rb
tumblr_wrapper-0.1.0 lib/tumblr_wrapper/client.rb