Class: Legato::Management::Profile
- Inherits:
-
Object
- Object
- Legato::Management::Profile
show all
- Extended by:
- Finder
- Includes:
- ProfileMethods
- Defined in:
- lib/legato/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 included from Finder
all, base_uri, get
add_profile_method, method_name_from_klass
Constructor Details
#initialize(attributes, user) ⇒ Profile
Returns a new instance of Profile.
27
28
29
30
31
32
33
34
35
|
# File 'lib/legato/management/profile.rb', line 27
def initialize(attributes, user)
self.user = user
GA_ATTRIBUTES.each do |key,string_key|
self.send("#{key}=", attributes.delete(string_key) || attributes.delete(key))
end
self.attributes = attributes
end
|
Instance Attribute Details
#account ⇒ Object
45
46
47
|
# File 'lib/legato/management/profile.rb', line 45
def account
@account ||= Account.from_child(self)
end
|
#attributes ⇒ Object
Returns the value of attribute attributes.
24
25
26
|
# File 'lib/legato/management/profile.rb', line 24
def attributes
@attributes
end
|
#user ⇒ Object
Returns the value of attribute user.
24
25
26
|
# File 'lib/legato/management/profile.rb', line 24
def user
@user
end
|
#web_property ⇒ Object
49
50
51
|
# File 'lib/legato/management/profile.rb', line 49
def web_property
@web_property ||= WebProperty.from_child(self)
end
|
Class Method Details
.build_from_summary(attributes, user, account, web_property) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/legato/management/profile.rb', line 57
def self.build_from_summary(attributes, user, account, web_property)
Profile.new(attributes, user).tap { |profile|
profile.account = account
profile.web_property = web_property
}
end
|
.default_path ⇒ Object
8
9
10
|
# File 'lib/legato/management/profile.rb', line 8
def self.default_path
"/accounts/~all/webproperties/~all/profiles"
end
|
.for_account(account) ⇒ Object
37
38
39
|
# File 'lib/legato/management/profile.rb', line 37
def self.for_account(account)
all(account.user, account.path+'/webproperties/~all/profiles')
end
|
.for_web_property(web_property) ⇒ Object
41
42
43
|
# File 'lib/legato/management/profile.rb', line 41
def self.for_web_property(web_property)
all(web_property.user, web_property.path+'/profiles')
end
|
Instance Method Details
#goals ⇒ Object
53
54
55
|
# File 'lib/legato/management/profile.rb', line 53
def goals
Goal.for_profile(self)
end
|
#path ⇒ Object
12
13
14
|
# File 'lib/legato/management/profile.rb', line 12
def path
"/accounts/#{account_id}/webproperties/#{web_property_id}/profiles/#{id}"
end
|