Class: Gattica::Goals
- Inherits:
-
Object
- Object
- Gattica::Goals
- Includes:
- Convertible
- Defined in:
- lib/gattica/goals.rb
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.
-
#goals ⇒ Object
readonly
Returns the value of attribute goals.
-
#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) ⇒ Goals
constructor
A new instance of Goals.
Methods included from Convertible
#to_h, #to_query, #to_s, #to_xml
Constructor Details
#initialize(xml) ⇒ Goals
Returns a new instance of Goals.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gattica/goals.rb', line 12 def initialize(xml) @id = xml.at(:id).inner_html @updated = DateTime.parse(xml.at(:updated).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'] @title = xml.at("dxp:property[@name='ga:profileName']").attributes['value'] @table_id = xml.at("dxp:property[@name='dxp:tableId']").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'] # @goals = xml.search('ga:goal').collect do |goal| { # :active => goal.attributes['active'], # :name => goal.attributes['name'], # :number => goal.attributes['number'].to_i, # :value => goal.attributes['value'].to_f, # } # end end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def account_id @account_id end |
#account_name ⇒ Object (readonly)
Returns the value of attribute account_name.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def account_name @account_name end |
#goals ⇒ Object (readonly)
Returns the value of attribute goals.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def goals @goals end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def id @id end |
#profile_id ⇒ Object (readonly)
Returns the value of attribute profile_id.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def profile_id @profile_id end |
#table_id ⇒ Object (readonly)
Returns the value of attribute table_id.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def table_id @table_id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def title @title end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def updated @updated end |
#web_property_id ⇒ Object (readonly)
Returns the value of attribute web_property_id.
8 9 10 |
# File 'lib/gattica/goals.rb', line 8 def web_property_id @web_property_id end |