Class: GoogleAnalytics::User
- Inherits:
-
Object
- Object
- GoogleAnalytics::User
- Defined in:
- lib/google_analytics/user.rb
Instance Method Summary collapse
- #account(id) ⇒ Object
- #accounts ⇒ Object
-
#initialize(username, password) ⇒ User
constructor
A new instance of User.
- #valid? ⇒ Boolean
Constructor Details
Instance Method Details
#account(id) ⇒ Object
17 18 19 20 21 |
# File 'lib/google_analytics/user.rb', line 17 def account(id) accounts.find do |account| account if account.id == id end end |
#accounts ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/google_analytics/user.rb', line 9 def accounts return @accounts if @accounts xml = @client.get('/feeds/accounts/default') @accounts = xml.xpath('//xmlns:entry').collect do |account_node| Account.from_node(@client, account_node) end end |
#valid? ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/google_analytics/user.rb', line 23 def valid? @client.login! true rescue NotAuthorized false end |