Class: Legato::Management::WebProperty
- Inherits:
-
Object
- Object
- Legato::Management::WebProperty
show all
- Extended by:
- Finder
- Includes:
- Model
- Defined in:
- lib/legato/management/web_property.rb
Constant Summary
collapse
- GA_ATTRIBUTES =
{
:id => 'id',
:name => 'name',
:account_id => 'accountId',
:website_url => 'websiteUrl'
}
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
#account ⇒ Object
33
34
35
|
# File 'lib/legato/management/web_property.rb', line 33
def account
@account ||= Account.from_child(self)
end
|
#profiles ⇒ Object
29
30
31
|
# File 'lib/legato/management/web_property.rb', line 29
def profiles
@profiles ||= Profile.for_web_property(self)
end
|
Class Method Details
.build_from_summary(attributes, user, account) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/legato/management/web_property.rb', line 43
def self.build_from_summary(attributes, user, account)
profiles = attributes.delete('profiles') || attributes.delete(:profiles)
WebProperty.new(attributes, user).tap { |web_property|
web_property.account = account
web_property.profiles = profiles.map { |profile|
profile['accountId'] = account.id
profile['webPropertyId'] = web_property.id
Profile.build_from_summary(profile, user, account, web_property)
}
}
end
|
.default_path ⇒ Object
6
7
8
|
# File 'lib/legato/management/web_property.rb', line 6
def self.default_path
"/accounts/~all/webproperties"
end
|
.for_account(account) ⇒ Object
25
26
27
|
# File 'lib/legato/management/web_property.rb', line 25
def self.for_account(account)
all(account.user, account.path+'/webproperties')
end
|
.from_child(child) ⇒ Object
37
38
39
40
41
|
# File 'lib/legato/management/web_property.rb', line 37
def self.from_child(child)
path = new({:id => child.web_property_id, :account_id => child.account_id}, nil).path
get(child.user, path)
end
|
Instance Method Details
#path ⇒ Object
10
11
12
|
# File 'lib/legato/management/web_property.rb', line 10
def path
"/accounts/#{account_id}/webproperties/#{id}"
end
|