Sha256: 58ba9e0881d2743b8b0bb2da68d6fafe06d8552cb3331d04fa01d79b492d60af
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module Garb class Profile attr_reader :table_id, :title, :account_name, :account_id, :web_property_id class Property include HappyMapper tag 'property' namespace 'http://schemas.google.com/analytics/2009' attribute :name, String attribute :value, String def instance_name name.from_ga.underscored end end class Entry include HappyMapper tag 'entry' element :title, String element :tableId, String, :namespace => 'http://schemas.google.com/analytics/2009' has_many :properties, Property end 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 def id @table_id.from_ga end 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 def self.first(id) all.detect {|profile| profile.id == id || profile.web_property_id == id } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
garb-0.4.0 | lib/garb/profile.rb |