Class: Garb::Management::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/garb/management/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/garb/management/account.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/garb/management/account.rb', line 5

def name
  @name
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/garb/management/account.rb', line 4

def path
  @path
end

#sessionObject

Returns the value of attribute session.



4
5
6
# File 'lib/garb/management/account.rb', line 4

def session
  @session
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/garb/management/account.rb', line 5

def title
  @title
end

Class Method Details

.all(session = Session) ⇒ Object



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

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

.new_from_entry(entry, session) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/garb/management/account.rb', line 12

def self.new_from_entry(entry, session)
   = new
  .session = session
  .path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '')
  .title = entry['title'].gsub('Google Analytics Account ', '') # can we get this in properties=?
  .properties = Garb.parse_properties(entry)
  
end

Instance Method Details

#goalsObject



34
35
36
# File 'lib/garb/management/account.rb', line 34

def goals
  @goals ||= Goal.(self)
end

#profilesObject



30
31
32
# File 'lib/garb/management/account.rb', line 30

def profiles
  @profiles ||= Profile.(self)
end

#properties=(properties) ⇒ Object



21
22
23
24
# File 'lib/garb/management/account.rb', line 21

def properties=(properties)
  self.id = properties["account_id"]
  self.name = properties["account_name"]
end

#web_propertiesObject



26
27
28
# File 'lib/garb/management/account.rb', line 26

def web_properties
  @web_properties ||= WebProperty.(self)
end