Class: Gattica::Account
- Inherits:
-
Object
- Object
- Gattica::Account
- Includes:
- Convertible
- Defined in:
- lib/gattica/account.rb
Overview
Represents an account that an authenticated user has access to
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#account_name ⇒ Object
readonly
Returns the value of attribute account_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#profile_id ⇒ Object
readonly
Returns the value of attribute profile_id.
-
#table_id ⇒ Object
readonly
Returns the value of attribute table_id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
-
#web_property_id ⇒ Object
readonly
Returns the value of attribute web_property_id.
Instance Method Summary collapse
-
#initialize(xml) ⇒ Account
constructor
A new instance of Account.
Methods included from Convertible
#to_h, #to_query, #to_s, #to_xml
Constructor Details
#initialize(xml) ⇒ Account
Returns a new instance of Account.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gattica/account.rb', line 11 def initialize(xml) @id = xml.at_xpath('xmlns:id').text @updated = DateTime.parse(xml.at_xpath('xmlns:updated').text) @title = xml.at_xpath('xmlns:title').text @table_id = xml.at_xpath('dxp:tableid').text @account_id = xml.at_xpath("dxp:property[@name='ga:accountId']")['value'].to_i @account_name = xml.at_xpath("dxp:property[@name='ga:accountName']")['value'] @profile_id = xml.at_xpath("dxp:property[@name='ga:profileId']")['value'].to_i @web_property_id = xml.at_xpath("dxp:property[@name='ga:webPropertyId']")['value'] end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def account_id @account_id end |
#account_name ⇒ Object (readonly)
Returns the value of attribute account_name.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def account_name @account_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def id @id end |
#profile_id ⇒ Object (readonly)
Returns the value of attribute profile_id.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def profile_id @profile_id end |
#table_id ⇒ Object (readonly)
Returns the value of attribute table_id.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def table_id @table_id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def title @title end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def updated @updated end |
#web_property_id ⇒ Object (readonly)
Returns the value of attribute web_property_id.
9 10 11 |
# File 'lib/gattica/account.rb', line 9 def web_property_id @web_property_id end |