Class: LazyGoogleAnalytics::Auth
- Inherits:
-
Object
- Object
- LazyGoogleAnalytics::Auth
- Defined in:
- lib/lazy_google_analytics/auth.rb
Instance Attribute Summary collapse
-
#analytics ⇒ Object
Returns the value of attribute analytics.
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize ⇒ Auth
Returns a new instance of Auth.
6 7 8 9 10 |
# 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 |
Instance Attribute Details
#analytics ⇒ Object
Returns the value of attribute analytics.
4 5 6 |
# File 'lib/lazy_google_analytics/auth.rb', line 4 def analytics @analytics end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/lazy_google_analytics/auth.rb', line 4 def client @client end |
Instance Method Details
#authorize ⇒ Object
12 13 14 15 16 |
# File 'lib/lazy_google_analytics/auth.rb', line 12 def @client = Google::APIClient.new() @client. = @asserter.() @analytics = @client.discovered_api("analytics",'v3') end |