首页 > 解决方案 > 如何要求 google api 客户端

问题描述

我正在使用google-api-clientgem 在 Google 日历中创建事件。

我从谷歌找到了文档:https ://developers.google.com/calendar/quickstart/ruby

因此,当我安装 gem 时,在命令之后rails console我尝试了 require libs:

require 'google/api_client', 
require 'google/apis',
require 'google/apis/calendar_v3'

在每个require我得到错误:LoadError: cannot load such file

宝石信息:

bundle info google-api-client

google-api-client (0.23.4)
Summary: Client for accessing Google APIs
Homepage: https://github.com/google/google-api-ruby-client
Path: /Users/danielsaifulin/.rvm/gems/ruby-2.4.0-rc1@sortd/gems/google-api-client-0.23.4`

标签: google-api-clientruby-on-rails-4.2ruby-2.4

解决方案


我不知道为什么,但是rails console当我调用 require 'google/apis' 时 - 它不起作用,但是当我在 rails helper 中的某个函数中运行时它起作用了。

所以,问题结束了。


推荐阅读