【发布时间】:2019-09-23 05:05:14
【问题描述】:
我正在尝试使用 google-ads-ruby 库来允许我们的 ruby on rails 应用程序用户将我们的应用程序与 Google Ads 连接起来,并为他们从他们的帐户中提取一些统计信息。 我安装了 gem 并设法对用户进行身份验证并获取 refresh_token。
现在我正在尝试开始从 Google 收集数据。
失败的第一件事是 their instructions 在我的代码中使用 require 'google/ads/google_ads' 要求 gem
我尝试将它添加到我的控制器并得到cannot load such file -- google/ads/google_ads
那么,根据their instructions,我应该可以运行这个:
client = Google::Ads::GoogleAds::GoogleAdsClient.new do |config|
config.client_id = Rails.application.secrets.google_oauth_client_id
config.client_secret = Rails.application.secrets.google_oauth_client_secret
config.developer_token = Rails.application.secrets.google_developer_token
config.refresh_token = @user.google_ads.refresh_token
end
accessible_customers = client.service.customer.list_accessible_customers().resource_names
accessible_customers.each do |resource_name|
puts "Customer resource name: #{resource_name}"
end
然后列出例如用户的帐户as described here。
但是,我收到了uninitialized constant Google::Ads::GoogleAds
有人知道怎么回事吗?
【问题讨论】:
标签: ruby-on-rails ruby google-ads-api