module LinkedIn::Helpers::Authorization
Constants
- DEFAULT_OAUTH_OPTIONS
Public Instance Methods
access_token()
click to toggle source
# File lib/linked_in/helpers/authorization.rb, line 23 def access_token @access_token ||= ::OAuth2::AccessToken.new(consumer, @auth_token) end
consumer()
click to toggle source
# File lib/linked_in/helpers/authorization.rb, line 13 def consumer @consumer ||= ::OAuth2::Client.new(@consumer_token, @consumer_secret, parse_oauth_options) end
Private Instance Methods
full_oauth_url_for(url_type, host_type)
click to toggle source
# File lib/linked_in/helpers/authorization.rb, line 49 def full_oauth_url_for(url_type, host_type) if @consumer_options["#{url_type}_url".to_sym] @consumer_options["#{url_type}_url".to_sym] else host = @consumer_options[:site] || @consumer_options[host_type] || DEFAULT_OAUTH_OPTIONS[host_type] path = @consumer_options[:"#{url_type}_path".to_sym] || DEFAULT_OAUTH_OPTIONS["#{url_type}_path".to_sym] "#{host}#{path}" end end
parse_oauth_options()
click to toggle source
since LinkedIn
uses api.linkedin.com for request and access token exchanges, but www.linkedin.com for authorize/authenticate, we have to take care of the url creation ourselves.
# File lib/linked_in/helpers/authorization.rb, line 40 def parse_oauth_options { :token_url => full_oauth_url_for(:token, :api_host), :authorize_url => full_oauth_url_for(:authorize, :auth_host), :site => @consumer_options[:site] || @consumer_options[:api_host] || DEFAULT_OAUTH_OPTIONS[:api_host], :raise_errors => false } end