Class: Gattica::Account

Inherits:
Object
  • Object
show all
Includes:
Convertible
Defined in:
lib/gattica/account.rb

Overview

Represents an account that an authenticated user has access to

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Convertible

#to_h, #to_query, #to_s, #to_xml

Constructor Details

#initialize(xml) ⇒ Account

Returns a new instance of Account.



14
15
16
17
18
19
20
21
22
23
# File 'lib/gattica/account.rb', line 14

def initialize(xml)
  @id = xml.at(:id).inner_html
  @updated = DateTime.parse(xml.at(:updated).inner_html)
  @title = xml.at(:title).inner_html
  @table_id = xml.at('dxp:tableid').inner_html
  @account_id = xml.at("dxp:property[@name='ga:accountId']").attributes['value'].to_i
  @account_name = xml.at("dxp:property[@name='ga:accountName']").attributes['value']
  @profile_id = xml.at("dxp:property[@name='ga:profileId']").attributes['value'].to_i
  @web_property_id = xml.at("dxp:property[@name='ga:webPropertyId']").attributes['value']
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



12
13
14
# File 'lib/gattica/account.rb', line 12

def 
  @account_id
end

#account_nameObject (readonly)

Returns the value of attribute account_name.



12
13
14
# File 'lib/gattica/account.rb', line 12

def 
  @account_name
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/gattica/account.rb', line 12

def id
  @id
end

#profile_idObject (readonly)

Returns the value of attribute profile_id.



12
13
14
# File 'lib/gattica/account.rb', line 12

def profile_id
  @profile_id
end

#table_idObject (readonly)

Returns the value of attribute table_id.



12
13
14
# File 'lib/gattica/account.rb', line 12

def table_id
  @table_id
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/gattica/account.rb', line 12

def title
  @title
end

#updatedObject (readonly)

Returns the value of attribute updated.



12
13
14
# File 'lib/gattica/account.rb', line 12

def updated
  @updated
end

#web_property_idObject (readonly)

Returns the value of attribute web_property_id.



12
13
14
# File 'lib/gattica/account.rb', line 12

def web_property_id
  @web_property_id
end