class LazyGoogleAnalytics::Auth

Attributes

analytics[RW]
client[RW]

Public Class Methods

new() click to toggle source
# File lib/lazy_google_analytics/auth.rb, line 6
def initialize
  config = LazyGoogleAnalytics::Config
  @key = Google::APIClient::PKCS12.load_key(config.key_file, config.pass_phrase)
  @asserter = Google::APIClient::JWTAsserter.new( config.email, config.scope, @key)
end

Public Instance Methods

authorize() click to toggle source
# File lib/lazy_google_analytics/auth.rb, line 12
def authorize
  @client = Google::APIClient.new()
  @client.authorization = @asserter.authorize()
  @analytics = @client.discovered_api("analytics",'v3')
end