Class: Legato::Management::Account

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



23
24
25
# File 'lib/legato/management/account.rb', line 23

def web_properties
  @web_properties ||= WebProperty.(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]

  .new(attributes, user).tap { ||
    .web_properties = properties.map { |property|
      property['accountId'] = .id
      WebProperty.build_from_summary(property, user, )
    }
  }
end

.default_pathObject



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.}
end

Instance Method Details

#pathObject



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

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

#profilesObject



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.(self)
end