Class: Legato::Management::WebProperty

Inherits:
Object
  • Object
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

#accountObject



33
34
35
# File 'lib/legato/management/web_property.rb', line 33

def 
  @account ||= Account.from_child(self)
end

#profilesObject



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, )
  profiles = attributes.delete('profiles') || attributes.delete(:profiles)

  WebProperty.new(attributes, user).tap { |web_property|
    web_property. = 
    web_property.profiles = profiles.map { |profile|
      profile['accountId'] = .id
      profile['webPropertyId'] = web_property.id
      Profile.build_from_summary(profile, user, , web_property)
    }
  }
end

.default_pathObject



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.()
  all(.user, .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.}, nil).path

  get(child.user, path)
end

Instance Method Details

#pathObject



10
11
12
# File 'lib/legato/management/web_property.rb', line 10

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