Class: GoogleAnalytics::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/google_analytics/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, url, title, id, profile_id) ⇒ Account

Returns a new instance of Account.



14
15
16
17
# File 'lib/google_analytics/account.rb', line 14

def initialize(client, url, title, id, profile_id)
  @client, @url, @title = client, url, title
  @id, @profile_id = id, profile_id
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/google_analytics/account.rb', line 4

def client
  @client
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/google_analytics/account.rb', line 4

def id
  @id
end

#profile_idObject (readonly)

Returns the value of attribute profile_id.



4
5
6
# File 'lib/google_analytics/account.rb', line 4

def profile_id
  @profile_id
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/google_analytics/account.rb', line 4

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/google_analytics/account.rb', line 4

def url
  @url
end

Class Method Details

.from_node(client, node) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/google_analytics/account.rb', line 6

def self.from_node(client, node)
  new client, 
      node.xpath('.//xmlns:id').first.content, 
      node.xpath('.//dxp:property[@name="ga:accountName"]', 'dxp' => DXP_NAMESPACE).first.attributes['value'].to_s,
      node.xpath('.//dxp:property[@name="ga:accountId"]', 'dxp' => DXP_NAMESPACE).first.attributes['value'].to_s,
      node.xpath('.//dxp:property[@name="ga:profileId"]', 'dxp' => DXP_NAMESPACE).first.attributes['value'].to_s
end

Instance Method Details

#report(options = {}) ⇒ Object



19
20
21
# File 'lib/google_analytics/account.rb', line 19

def report(options={})
  Report.new(self, options)
end