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

- (Object) id

Returns the value of attribute id



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

def id
  @id
end

- (Object) name

Returns the value of attribute name



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

def name
  @name
end

- (Object) path

Returns the value of attribute path



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

def path
  @path
end

- (Object) session

Returns the value of attribute session



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

def session
  @session
end

- (Object) title

Returns the value of attribute title



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

def title
  @title
end

Class Method Details

+ (Object) all(session = Session)



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

+ (Object) new_from_entry(entry, session)



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

- (Object) goals



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

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

- (Object) profiles



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

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

- (Object) properties=(properties)



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

- (Object) web_properties



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

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