Class: Analytics::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/analytics/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ Client

Returns a new instance of Client.



5
6
7
8
# File 'lib/analytics/client.rb', line 5

def initialize(access_token)
  @access_token = access_token
  raise Analytics::Error::NoAccessTokenProvided if @access_token.nil?
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



3
4
5
# File 'lib/analytics/client.rb', line 3

def access_token
  @access_token
end

Instance Method Details

#accountsObject



10
11
12
# File 'lib/analytics/client.rb', line 10

def accounts
 @accounts ||= request_accounts
end

#flush!Object



22
23
24
# File 'lib/analytics/client.rb', line 22

def flush!
  @accounts = nil
end

#profilesObject



18
19
20
# File 'lib/analytics/client.rb', line 18

def profiles
  web_properties.map(&:profiles).flatten
end

#web_propertiesObject



14
15
16
# File 'lib/analytics/client.rb', line 14

def web_properties
  accounts.map(&:web_properties).flatten
end