Class: Garb::Management::Goal
- Inherits:
-
Object
- Object
- Garb::Management::Goal
- Defined in:
- lib/garb/management/goal.rb
Instance Attribute Summary (collapse)
-
- (Object) active
(also: #active?)
Returns the value of attribute active.
-
- (Object) destination
Returns the value of attribute destination.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) number
Returns the value of attribute number.
-
- (Object) path
Returns the value of attribute path.
-
- (Object) session
Returns the value of attribute session.
-
- (Object) value
Returns the value of attribute value.
Class Method Summary (collapse)
- + (Object) 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)
Instance Method Summary (collapse)
Instance Attribute Details
- (Object) active 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 |
- (Object) destination
Returns the value of attribute destination
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def destination @destination end |
- (Object) name
Returns the value of attribute name
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def name @name end |
- (Object) number
Returns the value of attribute number
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def number @number end |
- (Object) path
Returns the value of attribute path
5 6 7 |
# File 'lib/garb/management/goal.rb', line 5 def path @path end |
- (Object) session
Returns the value of attribute session
5 6 7 |
# File 'lib/garb/management/goal.rb', line 5 def session @session end |
- (Object) value
Returns the value of attribute value
6 7 8 |
# File 'lib/garb/management/goal.rb', line 6 def value @value end |
Class Method Details
+ (Object) all(session = Session, path = '/accounts/~all/webproperties/~all/profiles/~all/goals'))
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 |
+ (Object) for_account(account)
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 |
+ (Object) for_profile(profile)
23 24 25 |
# File 'lib/garb/management/goal.rb', line 23 def self.for_profile(profile) all(profile.session, profile.path + '/goals') end |
+ (Object) for_web_property(web_property)
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 |
+ (Object) new_from_entry(entry, session)
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
- (Object) properties=(properties)
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 |