Class: Hisui::Management::Goal

Inherits:
Base
  • Object
show all
Defined in:
lib/hisui/management/goal.rb

Constant Summary collapse

GA_ATTRIBUTES =
{
  :id => 'id',
  :name => 'name',
  :account_id => 'accountId',
  :web_property_id => 'webPropertyId',
  :profile_id => 'profileId'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, base_uri

Constructor Details

#initialize(attributes, user) ⇒ Goal



15
16
17
18
19
20
21
22
# File 'lib/hisui/management/goal.rb', line 15

def initialize(attributes, user)
  GA_ATTRIBUTES.each do |key, string_key|
    self.send("#{key}=", attributes.delete(string_key) || attributes.delete(key))
  end

  @attributes = attributes
  @user = user
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



13
14
15
# File 'lib/hisui/management/goal.rb', line 13

def attributes
  @attributes
end

#userObject

Returns the value of attribute user.



13
14
15
# File 'lib/hisui/management/goal.rb', line 13

def user
  @user
end

Class Method Details

.default_pathObject



25
26
27
# File 'lib/hisui/management/goal.rb', line 25

def default_path
  '/accounts/~all/webproperties/~all/profiles/~all/goals'
end

.for_account(account) ⇒ Object



29
30
31
# File 'lib/hisui/management/goal.rb', line 29

def ()
  all(.user, .path + '/webproperties/~all/profiles/~all/goals')
end

.for_profile(profile) ⇒ Object



37
38
39
# File 'lib/hisui/management/goal.rb', line 37

def for_profile(profile)
  all(profile.user, profile.path + '/goals')
end

.for_web_property(web_property) ⇒ Object



33
34
35
# File 'lib/hisui/management/goal.rb', line 33

def for_web_property(web_property)
  all(web_property.user, web_property.path + '/profiles/~all/goals')
end

Instance Method Details

#pathObject



42
43
44
# File 'lib/hisui/management/goal.rb', line 42

def path
  self.class.default_path + '/' + id.to_s
end