Class: Garb::Profile

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

Defined Under Namespace

Classes: Entry, Property

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ Profile

Returns a new instance of Profile.



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

def initialize(entry)
  @title = entry.title
  @table_id = entry.tableId

  entry.properties.each do |p|
    instance_variable_set :"@#{p.instance_name}", p.value
  end
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



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

def 
  @account_id
end

#account_nameObject (readonly)

Returns the value of attribute account_name.



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

def 
  @account_name
end

#table_idObject (readonly)

Returns the value of attribute table_id.



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

def table_id
  @table_id
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Class Method Details

.allObject



44
45
46
47
48
# File 'lib/garb/profile.rb', line 44

def self.all
  url = "https://www.google.com/analytics/feeds/accounts/default"
  response = DataRequest.new(url).send_request      
  Entry.parse(response.body).map {|entry| new(entry)}
end

Instance Method Details

#idObject



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

def id
  @table_id.from_ga
end