Class: Hisui::Management::Profile

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, base_uri

Constructor Details

#initialize(attributes, user) ⇒ Profile

Returns a new instance of Profile.



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

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.



12
13
14
# File 'lib/hisui/management/profile.rb', line 12

def attributes
  @attributes
end

#userObject

Returns the value of attribute user.



12
13
14
# File 'lib/hisui/management/profile.rb', line 12

def user
  @user
end

Class Method Details

.build_from_summary(attributes, user) ⇒ Object



28
29
30
# File 'lib/hisui/management/profile.rb', line 28

def build_from_summary(attributes, user)
  Profile.new(attributes, user)
end

.default_pathObject



24
25
26
# File 'lib/hisui/management/profile.rb', line 24

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

.for_account(account) ⇒ Object



32
33
34
# File 'lib/hisui/management/profile.rb', line 32

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

.for_web_property(web_property) ⇒ Object



36
37
38
# File 'lib/hisui/management/profile.rb', line 36

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

Instance Method Details

#goalsObject

XXX: Only use ‘user.profiles.#profile.goals

Cannot use `web_properties.#{web_property}.profiles.#{profile}.goals


47
48
49
# File 'lib/hisui/management/profile.rb', line 47

def goals
  Goal.for_profile(self)
end

#pathObject



41
42
43
# File 'lib/hisui/management/profile.rb', line 41

def path
  "/accounts/#{}/webproperties/#{web_property_id}/profiles/#{id}"
end