Class: Legato::Management::Account
- Inherits:
-
Object
- Object
- Legato::Management::Account
show all
- Extended by:
- Finder
- Includes:
- Model
- Defined in:
- lib/legato/management/account.rb
Constant Summary
collapse
- GA_ATTRIBUTES =
{
:id => 'id',
:name => 'name'
}
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Finder
all, base_uri, get
Methods included from Model
#build, included, #initialize
Instance Attribute Details
#web_properties ⇒ Object
23
24
25
|
# File 'lib/legato/management/account.rb', line 23
def web_properties
@web_properties ||= WebProperty.for_account(self)
end
|
Class Method Details
.build_from_summary(attributes, user) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/legato/management/account.rb', line 37
def self.build_from_summary(attributes, user)
properties = attributes['webProperties'] || attributes[:webProperties]
Account.new(attributes, user).tap { |account|
account.web_properties = properties.map { |property|
property['accountId'] = account.id
WebProperty.build_from_summary(property, user, account)
}
}
end
|
.default_path ⇒ Object
6
7
8
|
# File 'lib/legato/management/account.rb', line 6
def self.default_path
"/accounts"
end
|
.from_child(child) ⇒ Object
33
34
35
|
# File 'lib/legato/management/account.rb', line 33
def self.from_child(child)
all(child.user).detect {|a| a.id == child.account_id}
end
|
Instance Method Details
#path ⇒ Object
10
11
12
|
# File 'lib/legato/management/account.rb', line 10
def path
"/accounts/#{id}"
end
|
#profiles ⇒ Object
27
28
29
30
31
|
# File 'lib/legato/management/account.rb', line 27
def profiles
@web_properties ?
@web_properties.map { |property| property.profiles }.flatten :
Profile.for_account(self)
end
|