fosome / garb Goto Github PK
View Code? Open in Web Editor NEWA Ruby wrapper for the Google Analytics API
Home Page: http://www.viget.com/extend/
A Ruby wrapper for the Google Analytics API
Home Page: http://www.viget.com/extend/
Hi,
I'm new to the usage of gard in ror. Currently I'm having some problem getting the data from GA as the openstruct returns a empty table,
My code is:
class AnalyticsController < ApplicationController
include Garb
def index
Session.login('xxx', 'xxx')
@Profile = Profile.all.detect{|p| p.table_id == 'xxxxx'.to_ga}
@results = Hits.results(@Profile)# do
end
end
class Hits
include Garb::Resource
metrics :pageviews
dimensions :pagepath
end
I'm not very sure which part went wrong, but hope someone can give me some guidance. Could it be something to do with the namespace issue?
I should be able to override the class that will be used to create a new report from the hash of variables returned, obvious usage is for persisting data.
example 1:
class Exits
include Garb::Resource
metrics :pageviews, :exits
dimensions :request_uri
end
pp Exits.results(profile) do
filter :exits.gte => 100
sort :exits.desc
end
it gave wrong result (not sorted, not filtred):
[#<OpenStruct pageviews="767", exits="150", request_uri="/">,
#<OpenStruct pageviews="276", exits="42", request_uri="/atrakcje.html">]
but when i do:
report = Garb::Report.new(profile, :limit => 2)
report.metrics :pageviews, :exits
report.dimensions :request_uri
report.filter :exits.gte => 100
report.sort :exits.desc
pp report.results
result is correct:
[#<OpenStruct pageviews="563", exits="172", request_uri="/galeria.html">,
#<OpenStruct pageviews="767", exits="150", request_uri="/">]
did i do something wrong or it's a bug ?
Currently the id is the only supported method, perhaps some other key value could be used to allow for an API like this:
segment :segment_name
Readme is incorrect:
sudo gem install garb -s http://gems.github.com spits out an error.
Should be : sudo gem install vigetlabs-garb -s http://gems.github.com
Trying to install the gem, I get:
ERROR: Error installing garb:
invalid gem format for /opt/local/lib/ruby/gems/1.8/cache/garb-0.7.6.gem
My environment is OSX 10.6, ruby 1.8.7-174, rubygems 1.3.6. Any ideas?
Hey, I can authenticate ok, but get the following error when I try to access the Account or Profile features. Any ideas?
/Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb.rb:36:in to_ga': undefined method
camelize' for "goal":String (NoMethodError)
from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:12:in initialize' from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:24:in
new'
from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:24:in all' from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:24:in
map'
from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:24:in all' from /Users/dan/.rvm/gems/ruby-1.8.7-p174/gems/garb-0.7.6/lib/garb/profile.rb:28:in
first'
Hi - thanks for a great gem - been using this in my first programming attempt ever, and it's been going well.
However, I got sent some new requests for my script, that I can only picture working (nicely) if I use segments.
The API feed query exporter allows me to use these like this:
segment=gaid::95904094
But a search through the GARB source and docs makes me think there's no support for this in GARB - is this right?
In either case, cheers for your work; and for answering what I can now see was a pretty obvious question a few months back...
Because the < and > operators don't work against dimensions, in order to build ranges targeting dimensions such as daysSinceLastVisit, one would like to do something akin to
filters do
[1..7].each {|i| eql(:days_since_last_visit, i) }
end
Because Garb uses a hash to store the filters, and keys that hash on the (target, operator) pair, doing this appears to be impossible.
Thoughts?
I seem to be getting arrays for my results, rather than an ostruct.
Example:
class Reports
def things
report = Garb::Report.new($profile)
report.metrics :pageviews
thing = report.results
snip
puts thing.pageviews => in things': undefined method
pageviews' for [#]:Array (NoMethodError)
puts report.results.inspect => [#<OpenStruct pageviews="10">]
puts thing => #<OpenStruct pageviews="10">
puts thing[0] => #<OpenStruct pageviews="10">
Sorry new to ruby and reporting this sort of thing - apologies if this is an obvious error on my part, or if this is the wrong way to report.
Research the new GA features (e.g., intelligence, goals, events) to determine if there is an API around this data.
I tried to get a report for a campaign that does not exist.
In 0.7.2 the result was just an empty array (which I think is good),
The new version results in the following error when I try to get the results:
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
/var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:30:in values_for' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:30:in map' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:30:in values_for' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:16:in parse' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:15:in map' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:15:in parse' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/report_response.rb:10:in results' /var/lib/gems/1.8/gems/garb-0.7.4/lib/garb/resource.rb:54:in results
All the pre-built reports in lib/garb/reports.rb break because they are using the #metric method rather than the #metrics method.
Fixed in http://github.com/scudco/garb/commit/3cef6c37fbf6530c67b16e3c8755b7990e3cb56a
About 50% of the time I get a Timeout::Error when trying to retrieve a profile.
All I'm doing is this:
Garb::Profile.first(profile_id)
Running the example found in the Wiki:
report.sort :exit_rate.desc
I get the error
undefined method `desc' for :exit_rate:Symbol
This is on ruby 1.8.7.
Thanks for the library!
This may seem confusing, but it resulted in much more confusion on my end, so hopefully it makes sense. When you use extend Garb::Model
and call results, these results bleed across multiple results calls with different filters.
I had this code:
module BrowserUsage
class BrowserName
extend Garb::Model
dimensions :browser
metrics :visits
end
class BrowserVersion
extend Garb::Model
dimensions :browser_version
metrics :visits
end
def self.browser_name_results(profile)
BrowserName.results(profile)
end
def self.browser_version_results(profile, browser)
BrowserVersion.results(profile) do
filters :browser.eql(:browser, browser)
end
end
end
When calling BrowserUsage.browser_version_results(profile, 'Firefox')
and then calling BrowserUsage.browser_version_results(profile, 'Safari')
— you'll end up with the same amount of visits on both result sets.
I've fixed this locally by just using the one-off reports that now work (yay!), but it's something that definitely made me pretty confused trying to figure out why my data was wrong.
If I want to get the bounce rate, I should be able to define that as a method on an instance of a report, using metrics and dimensions.
As a method of "caching" the accounts, so the profiles do not need to be re-requested, a session should store an instance variable collection of accounts.
If the user of garb knows the segment ids, they should be able to reference that id by name in multiple reports, without having to use the id #.
Example usage:
Garb.available_segments = {:not_new_york => 0}
report = Garb::Report.new(profile)
report.segment :not_new_york
report.metrics :pageviews
pp report.results
Seriously, this should work on 1.9, need to verify, though.
I'm able to successfully create a Garb::Session but then I run into a problem:
Garb::Account.all
NoMethodError: undefined methodstring' for XMLParser:Class from /Library/Ruby/Gems/1.8/gems/happymapper-0.3.0/lib/happymapper.rb:75:in
parse'
from /Library/Ruby/Gems/1.8/gems/garb-0.7.0/lib/garb/profile.rb:50:inall' from /Library/Ruby/Gems/1.8/gems/garb-0.7.0/lib/garb/account.rb:14:in
all'
from (irb):2
I can't, for the life of me, figure out when this started occurring and/or how to start debugging. Any help?
Getting this error
undefined method ‘mattr_accessor’ for ActiveSupport::Deprecation:Module
For this script:
# require "active_support"
require "garb"
class Exits
extend Garb::Resource
metrics :exits, :pageviews
dimensions :page_path
sort :exits
end
Garb::Session.login("XXXX", "XXXX")
profile = Garb::Profile.first('XXXXX')
pp Exits.results(profile)
Adding require "active_support" seemed to fix it?
In authentication_request.rb, the parameter 'accountType' should be 'GOOGLE', not 'HOSTED_OR_GOOGLE'.
This will make this library work with Google Apps hosted emails that also have an Analytics account (or else Google will log me in the hosted "gmail" account, rather than the "google" analytics account).
So just change the accountType to "GOOGLE" or allow me to pass a parameter to do so...
very simple example was working before
require 'rubygems'
require 'garb'
require 'postgres'
require 'ruby-debug'
class Analytics
include Garb::Resource
Garb::Session.login(username, password)
Garb::Account.all
end
produces the following
/Library/Ruby/Gems/1.8/gems/garb-0.2.5/lib/garb/data_request.rb:24
raise response.body.inspect unless response.is_a?(Net::HTTPOK)
RuntimeError: "Accounts URL did not end in /default"
method send_request in data_request.rb at line 24
method all in profile.rb at line 46
method all in account.rb at line 12
at top level in analytics.rb at line 8
My test file:
require 'rubygems'
require 'garb'
username = '***'
password = '***'
Garb::Session.login(username, password)
Garb::Account.all
Error:
/home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb.rb:36:in `to_ga': undefined method `camelize' for "goal":String (NoMethodError)
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/profile.rb:12:in `initialize'
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/profile.rb:24:in `new'
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/profile.rb:24:in `all'
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/profile.rb:24:in `map'
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/profile.rb:24:in `all'
from /home/lamnk/.rvm/gems/ruby-1.8.7-p302/gems/garb-0.7.6/lib/garb/account.rb:14:in `all'
from test.rb:10
This line is not very nice from a security standpoint:
http://github.com/vigetlabs/garb/blob/4437f9941791043c869b942c5524c7c4e9fcd5e4/lib/garb/authentication_request.rb#L29
Should be:
http.verify_mode = OpenSSL::SSL::VERIFY_PEER store = OpenSSL::X509::Store.new store.set_default_paths http.cert_store = store
Upon attempting to login, I receive the following error from Garb. See my irb session:
irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'garb' => true irb(main):003:0> Garb::Session.login("login", "pass") NoMethodError: undefined method `closed?' for nil:NilClass from /usr/lib/ruby/1.8/net/http.rb:1060:in `request' from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:36:in `send_request' from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/authentication_request.rb:49:in `auth_token' from /usr/lib/ruby/gems/1.8/gems/garb-0.8.0/lib/garb/session.rb:10:in `login' from (irb):3 from /usr/local/lib/site_ruby/1.8/rubygems/exceptions.rb:8
I am running Ruby 1.8.7 and have tried with ActiveSupport 3.0.0 and 2.3.8. My crack version is 0.1.8
EDIT: It seems this error is only happening when the user/pass is incorrect.
The following code results in a 401 (Unknown authorization header) from GA, but works fine when using Garb::Session.login. The problem seems to be fixed by 32c3eb6.
(You'll need to set 'token' and 'secret' to run the code below, but it should otherwise work as-is.)
I suspect that the problem is that the OAuth gem is not escaping semicolons when constructing the canonical URL, but Google are escaping them when checking the signature - this explains why we only trip up when there are semicolons in the URL (for example when using multiple filters).
#!/usr/bin/env ruby
require 'rubygems'
require 'oauth'
require 'garb'
consumer = OAuth::Consumer.new('anonymous', 'anonymous', {
:site => 'https://www.google.com',
})
Garb::Session.access_token = OAuth::AccessToken.new(consumer, token, secret)
profile = Garb::Account.all.first.profiles.first
class Visits
extend Garb::Resource
metrics :visits
filters do
contains(:keyword, 'your')
eql(:medium, 'cpc')
end
end
results = Visits.results(profile)
I see the README says that documentation for AND/OR is on the TODO, but I think that the DSL might not be currently capable of properly OR filtering.
The following works.... but how do you generate it programmatically? I can't build a Ruby Hash of duplicate keys.
report.filters({:page_path.eql => 'index', :page_path.eql => 'home'})
So I try the block method
report.filters do
['index', 'home'].each do |path|
eql(:page_path, path)
end
end
But that ends up using the AND operator: filters=ga:pagePath%3D%3Dindex;ga:pagePath%3D%3Dhome
So I try the next obvious thing:
report.filters do
eql(:page_path, ['index', 'home'])
end
But that just results in filters=ga:pagePath%3D%3Dindexhome
when it should be filters=ga:pagePath%3D%3Dindex,ga:pagePath%3D%3Dhome
Anyone get this working or should we rework this part of the DSL?
Is there a possibility to integrate garb sessions with google authsub sessions?
Hey,
First, thanks for all the contributors to garb, it is very helpful for integration with google analytics. I have a need to query to 'default page' setting(https://www.google.com/support/googleanalytics/bin/answer.py?answer=32995&hl=en_US) for a profile, so is there anyway to get it from garb?
Thanks.
Sean
The AccountFeed provides more data than is currently accessible with Garb. I personally have a need to list all of the goals (and relevant attributes) configured for each account and / or profile.
Here is a full list of the data available:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html
Does not install on JRuby as it cannot build native extensions. I guess it should be the happymapper that has native extensions?
After some digging i find that libxml-ruby which is required by HappyMapper is the problem so it is an issue of HappyMapper
I hope Garb support access under proxy server.
Should be able to get the list of available segments for a profile.
Somebody can help me??
I try to use garb with auth_token way but always compare this error
private method `gsub' called for nil:NilClass
what happend??
I tried to run the tests via 'rake test' but it fails with the error
/usr/local/bin/ruby -I"lib:test" "/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/garb/account_test.rb" "test/unit/garb/authentication_request_test.rb" "test/unit/garb/data_request_test.rb" "test/unit/garb/filter_parameters_test.rb" "test/unit/garb/oauth_session_test.rb" "test/unit/garb/operator_test.rb" "test/unit/garb/profile_test.rb" "test/unit/garb/report_parameter_test.rb" "test/unit/garb/report_response_test.rb" "test/unit/garb/report_test.rb" "test/unit/garb/resource_test.rb" "test/unit/garb/session_test.rb" "test/unit/garb_test.rb"
./test/unit/garb/account_test.rb:5: undefined method `context' for Garb::AccountTest:Class (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -I"lib:test" "/usr/loc...]
I installed the gem minitest but without any success. What's my fault?
Thanks,
Martin
Just noticed that there are issues when upgrading happy mapper to 0.3.0 looking into them further.
Okay, I've really started to use this for some crazy GA work, and the api around filtering on an existing report class really sucks, and there's no reason to make a one-off report just to have filtering.
Fix it!
class Something include Garb::Resource filter :page_path.contains => /test/ end
gives:
NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<< from /usr/lib/ruby/gems/1.8/gems/vigetlabs-garb-0.2.1/lib/garb/resource.rb:23:in `filter'
Having a problem using the start_date and end_date parameters. After struggling for a bit, I copied and pasted in this code directly from: http://www.viget.com/extend/updated-garb-even-easier-access-to-the-google-analytics-api/
report.results(:limit => 10,
:offset => 20,
:start_date => (Date.today - 30),
:end_date => Date.today)
And I still have the problem. Thanks for any help!
Processing StatsController#index (for 127.0.0.1 at 2009-06-02 12:40:51) [GET]
Parameters: {"action"=>"index", "controller"=>"stats"}
ArgumentError (wrong number of arguments (1 for 0)):
/app/models/stats.rb:32:in results' /app/models/stats.rb:32:in
generateStats'
/app/controllers/stats_controller.rb:4:in index' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in
send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in
call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:610:in perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/rescue.rb:136:in perform_action_without_caching' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:13:in
perform_action'
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in cache' /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/query_cache.rb:8:in
cache'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/caching/sql_cache.rb:12:in perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in
send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:524:in process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:606:in
process_without_session_management_support'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:134:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in
process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:in handle_request' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in
dispatch_unlocked'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
synchronize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in
dispatch_cgi'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in dispatch' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in synchronize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in
load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in load' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in
new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in load' /Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/servers/mongrel.rb:64 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in
require'
/Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
script/server:3
when using has_one association and try to eager load using :include you get the following errror
NoMethodError (undefined method `macro' for #RealEstate:0x227f798):
The conflict happens @ ActiveRecord::AssociationPreload::ClassMethods in preload_one_association where the function uses group_by function on an array. Garb redefines the array group_by function which causes the problem.
Hey,
'NoMethodError' was thrown when I tried to call Garb::Profile.all(no google analytics account in my gmail account), the following is the code used to access google analytics data:
access_token, access_secret = user.access_tokens.last
Garb::Session.access_token = OAuth::AccessToken.new(GoogleAuth.consumer, access_token, access_secret)
profiles = Garb::Profile.all
And here is the backtrace:
from /Users/bob/.rvm/gems/ruby-1.8.7-p249/gems/garb-0.8.4/lib/garb/profile.rb:10:in initialize' from /Users/bob/.rvm/gems/ruby-1.8.7-p249/gems/garb-0.8.4/lib/garb/profile.rb:25:in
new'
from /Users/bob/.rvm/gems/ruby-1.8.7-p249/gems/garb-0.8.4/lib/garb/profile.rb:25:in all' from /Users/bob/.rvm/gems/ruby-1.8.7-p249/gems/garb-0.8.4/lib/garb/profile.rb:25:in
map'
from /Users/bob/.rvm/gems/ruby-1.8.7-p249/gems/garb-0.8.4/lib/garb/profile.rb:25:in `all'
I think we need to return an empty array if there are no any google analytics accounts.
Thanks.
Sean
As stated in Google authentication documentation:
http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
accountType should be set to HOSTED_OR_GOOGLE.
But this is no longer correct. The correct version is GOOGLE_OR_HOSTED (words reversed) which I discovered after 30 minutes of banging my head against the wall.
So this line:
http://github.com/vigetlabs/garb/blob/4437f9941791043c869b942c5524c7c4e9fcd5e4/lib/garb/authentication_request.rb#L16
should be updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.