Skip to content

Commit

Permalink
Don't eagerly initialize oauth client w/ incomplete options
Browse files Browse the repository at this point in the history
  • Loading branch information
5long committed Mar 31, 2013
1 parent e201c7e commit 4b27063
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/github_api/api.rb
Expand Up @@ -41,7 +41,6 @@ class API
#
def initialize(options={}, &block)
setup(options)
client(options) if client_id? && client_secret?
yield_or_eval(&block) if block_given?
end

Expand Down
4 changes: 2 additions & 2 deletions lib/github_api/authorization.rb
Expand Up @@ -6,10 +6,10 @@ module Authorization
attr_accessor :scopes

# Setup OAuth2 instance
def client(options={})
def client
@client ||= ::OAuth2::Client.new(client_id, client_secret,
{
:site => options.fetch(:site) { Github.site },
:site => current_options.fetch(:site) { Github.site },
:authorize_url => 'login/oauth/authorize',
:token_url => 'login/oauth/access_token',
:ssl => { :verify => false }
Expand Down

0 comments on commit 4b27063

Please sign in to comment.