Class: Garb::Management::Goal
- Inherits:
-
Object
- Object
- Garb::Management::Goal
- Defined in:
- lib/garb/management/goal.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
(also: #active?)
Returns the value of attribute active.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#path ⇒ Object
Returns the value of attribute path.
-
#session ⇒ Object
Returns the value of attribute session.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
- .all(session = Session, path = '/accounts/~all/webproperties/~all/profiles/~all/goals') ⇒ Object
- .for_account(account) ⇒ Object
- .for_profile(profile) ⇒ Object
- .for_web_property(web_property) ⇒ Object
- .new_from_entry(entry, session) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#active ⇒ Object Also known as: active?
Returns the value of attribute active.
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def active @active end |
#destination ⇒ Object
Returns the value of attribute destination.
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def destination @destination end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def number @number end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/garb/management/goal.rb', line 5 def path @path end |
#session ⇒ Object
Returns the value of attribute session.
5 6 7 |
# File 'lib/garb/management/goal.rb', line 5 def session @session end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def value @value end |
Class Method Details
.all(session = Session, path = '/accounts/~all/webproperties/~all/profiles/~all/goals') ⇒ Object
10 11 12 13 |
# File 'lib/garb/management/goal.rb', line 10 def self.all(session = Session, path = '/accounts/~all/webproperties/~all/profiles/~all/goals') feed = Feed.new(session, path) feed.entries.map {|entry| new_from_entry(entry, session)} end |
.for_account(account) ⇒ Object
15 16 17 |
# File 'lib/garb/management/goal.rb', line 15 def self.for_account(account) all(account.session, account.path + '/webproperties/~all/profiles/~all/goals') end |
.for_profile(profile) ⇒ Object
23 24 25 |
# File 'lib/garb/management/goal.rb', line 23 def self.for_profile(profile) all(profile.session, profile.path + '/goals') end |
.for_web_property(web_property) ⇒ Object
19 20 21 |
# File 'lib/garb/management/goal.rb', line 19 def self.for_web_property(web_property) all(web_property.session, web_property.path + '/profiles/~all/goals') end |
.new_from_entry(entry, session) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/garb/management/goal.rb', line 27 def self.new_from_entry(entry, session) goal = new goal.session = session goal.path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '') goal.properties = entry[Garb.to_ga('goal')] goal end |
Instance Method Details
#properties=(properties) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/garb/management/goal.rb', line 35 def properties=(properties) self.name = properties["name"] self.number = properties["number"].to_i self.value = properties["value"].to_f self.active = (properties["active"] == "true") self.destination = Destination.new(properties[Garb.to_ga('destination')]) end |