Class: Garb::Management::Account
- Inherits:
-
Object
- Object
- Garb::Management::Account
- Defined in:
- lib/garb/management/account.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#session ⇒ Object
Returns the value of attribute session.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/garb/management/account.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/garb/management/account.rb', line 5 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/garb/management/account.rb', line 4 def path @path end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/garb/management/account.rb', line 4 def session @session end |
#title ⇒ Object
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) account = new account.session = session account.path = Garb.parse_link(entry, "self").gsub(Feed::BASE_URL, '') account.title = entry['title'].gsub('Google Analytics Account ', '') # can we get this in properties=? account.properties = Garb.parse_properties(entry) account end |
Instance Method Details
#goals ⇒ Object
34 35 36 |
# File 'lib/garb/management/account.rb', line 34 def goals @goals ||= Goal.for_account(self) end |
#profiles ⇒ Object
30 31 32 |
# File 'lib/garb/management/account.rb', line 30 def profiles @profiles ||= Profile.for_account(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_properties ⇒ Object
26 27 28 |
# File 'lib/garb/management/account.rb', line 26 def web_properties @web_properties ||= WebProperty.for_account(self) end |