Class: Garb::Management::Profile

Inherits:
Object
  • Object
show all
Includes:
ProfileReports
Defined in:
lib/garb/management/profile.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ProfileReports

add_report_method

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



8
9
10
# File 'lib/garb/management/profile.rb', line 8

def 
  @account_id
end

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/garb/management/profile.rb', line 8

def id
  @id
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/garb/management/profile.rb', line 7

def path
  @path
end

#sessionObject

Returns the value of attribute session.



7
8
9
# File 'lib/garb/management/profile.rb', line 7

def session
  @session
end

#table_idObject

Returns the value of attribute table_id.



8
9
10
# File 'lib/garb/management/profile.rb', line 8

def table_id
  @table_id
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/garb/management/profile.rb', line 8

def title
  @title
end

#web_property_idObject

Returns the value of attribute web_property_id.



8
9
10
# File 'lib/garb/management/profile.rb', line 8

def web_property_id
  @web_property_id
end

Class Method Details

.all(session = Session, path = '/accounts/~all/webproperties/~all/profiles') ⇒ Object



10
11
12
13
# File 'lib/garb/management/profile.rb', line 10

def self.all(session = Session, path = '/accounts/~all/webproperties/~all/profiles')
  feed = Feed.new(session, path)
  feed.entries.map {|entry| new_from_entry(entry, session)}
end

.for_account(account) ⇒ Object



15
16
17
# File 'lib/garb/management/profile.rb', line 15

def self.()
  all(.session, .path+'/webproperties/~all/profiles')
end

.for_web_property(web_property) ⇒ Object



19
20
21
# File 'lib/garb/management/profile.rb', line 19

def self.for_web_property(web_property)
  all(web_property.session, web_property.path+'/profiles')
end

.new_from_entry(entry, session) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/garb/management/profile.rb', line 23

def self.new_from_entry(entry, session)
  profile = new
  profile.session = session
  profile.path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '')
  profile.properties = Garb.parse_properties(entry)
  profile
end

Instance Method Details

#goalsObject



39
40
41
# File 'lib/garb/management/profile.rb', line 39

def goals
  Goal.for_profile(self)
end

#properties=(properties) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/garb/management/profile.rb', line 31

def properties=(properties)
  self.id = properties['profile_id']
  self.table_id = properties['dxp:table_id']
  self.title = properties['profile_name']
  self. = properties['account_id']
  self.web_property_id = properties['web_property_id']
end