Sha256: affa63c34dfdd466788ce47c2ebef7d42edd11fb266087f544d5158c3c965a81

Contents?: true

Size: 831 Bytes

Versions: 12

Compression:

Stored size: 831 Bytes

Contents

require 'linkedin'

class LinkedinToken < ConsumerToken
  LINKEDIN_SETTINGS={
    :site => "https://api.linkedin.com", 
    :request_token_path => "/uas/oauth/requestToken",
    :access_token_path  => "/uas/oauth/accessToken",
    :authorize_path     => "/uas/oauth/authorize"
  }
  
  def self.consumer
    @consumer ||= create_consumer
  end 
  
  def self.create_consumer(options={})
    OAuth::Consumer.new(credentials[:key], credentials[:secret], LINKEDIN_SETTINGS.merge(options))
  end
    
  def self.get_request_token(callback_url)
    consumer.get_request_token({ :oauth_callback => callback_url })
  end
  
  def client
    unless @client
      @client = ::LinkedIn::Client.new(LinkedinToken.consumer.key, LinkedinToken.consumer.secret)
      @client.authorize_from_access(token, secret)
    end 
    @client
  end
  
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
muck-oauth-0.2.4 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.2.3 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.2.2 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.2.1 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.2.0 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.11 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.9 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.8 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.7 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.6 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.5 lib/muck_oauth/services/linkedin_token.rb
muck-oauth-0.1.4 lib/muck_oauth/services/linkedin_token.rb