class Ruboty::GoogleSpreadsheet::Client

Constants

SCOPE

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/ruboty/google_spreadsheet/client.rb, line 8
def initialize(attrs = {})
  @authorization = api_client.authorization
  @authorization.client_id = attrs[:client_id]
  @authorization.client_secret = attrs[:client_secret]
  @authorization.scope = SCOPE
  @authorization.redirect_uri = attrs[:redirect_uri]
  @refresh_token = attrs[:refresh_token]
end

Public Instance Methods

access_token() click to toggle source
# File lib/ruboty/google_spreadsheet/client.rb, line 23
def access_token
  @authorization.access_token
end
authorize!() click to toggle source
# File lib/ruboty/google_spreadsheet/client.rb, line 17
def authorize!
  @authorization.refresh_token = @refresh_token
  @authorization.fetch_access_token!
  @refresh_token = @authorization.refresh_token
end

Private Instance Methods

api_client() click to toggle source
# File lib/ruboty/google_spreadsheet/client.rb, line 29
def api_client
  @api_client ||= Google::APIClient.new(
    application_name: "ruboty-google_spreadsheet",
    application_version: VERSION
  )
end