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

Constructor Details

#initialize(entry, session) ⇒ Account

Returns a new instance of Account.



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

def initialize(entry, session)
  @session = session
  @path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '')
  @title = entry['title'].gsub('Google Analytics Account ', '')

  properties = Garb.parse_properties(entry)
  @id = properties["account_id"]
  @name = properties["account_name"]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

#sessionObject (readonly)

Returns the value of attribute session.



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

def session
  @session
end

#titleObject (readonly)

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
11
# File 'lib/garb/management/account.rb', line 7

def self.all(session = Session)
  feed = Feed.new(session, '/accounts') # builds request and parses response

  feed.entries.map {|entry| new(entry, session)}
end

Instance Method Details

#profilesObject



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

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

#web_propertiesObject



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

def web_properties
  @web_properties ||= WebProperty.(self) # will call path
end