class ProjectsController < ApplicationController require "rubygems" require "google_drive" def show client_id = "???????????"; client_secret = "???????????"; refresh_token = "???????????"; client = OAuth2::Client.new( client_id, client_secret, site:"https://accounts.google.com", token_url:"/o/oauth2/token", authorize_url:"/o/oauth2/auth") auth_token = OAuth2::AccessToken.from_hash(client, {:refresh_token => refresh_token, :expires_at => 3600}) auth_token = auth_token.refresh! session = GoogleDrive.login_with_oauth(auth_token.token) ws = session.spreadsheet_by_key("???????????").worksheets[0] //レコード数を取得 p ws.num_rows //カラム数を取得 p ws.num_cols end end
にて、表示しようとすると
uninitialized constant ProjectsController::OAuth2
Extracted source (around line #14): refresh_token = "???????????"; client = OAuth2::Client.new( client_id, client_secret,
の
client = OAuth2::Client.new(
の部分でエラーがでてしまいます。
gem install "oauth2"
などもしましたが、
解決できず、、
どのようにしたら解決できるかを教えていただきたいです。
あなたの回答
tips
プレビュー