52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/soothsayer.rb', line 52
def create_client
raise OAuthTokenError, 'Please configure Soothsayer first with Soothsayer.config.' if Soothsayer.credentials.nil?
client = Google::APIClient.new(:authorization => :oauth_2)
unless client.authorization.nil?
client.authorization.scope = nil
client.authorization.client_id = Soothsayer.credentials.client_id
client.authorization.client_secret = Soothsayer.credentials.client_secret
client.authorization.access_token = Soothsayer.credentials.access_token
client.authorization.refresh_token = Soothsayer.credentials.refresh_token
client.register_discovery_uri('discovery', 'v1.5', nil)
self.api_client = client
else
raise OAuthTokenError
end
end
|