class Bq::Base
Attributes
project_id[RW]
Public Class Methods
new(opts={})
click to toggle source
# File lib/bq.rb, line 12 def initialize(opts={}) @project_id = opts[:project_id] application_name = opts[:application_name] || "Bq" application_version = opts[:application_version] || Bq::VERSION @client = Google::APIClient.new( :application_name => application_name, :application_version => application_version ) self.token_storage = opts[:token_storage] if opts[:token_storage] if @token_storage && @token_storage.authorization @client.authorization = @token_storage.authorization elsif opts[:token] @client.authorization = opts[:token] end @bq_client = @client.discovered_api('bigquery', 'v2') end
Public Instance Methods
token()
click to toggle source
# File lib/bq.rb, line 43 def token @client.authorization end
token_storage=(storage)
click to toggle source
# File lib/bq.rb, line 32 def token_storage=(storage) if storage.kind_of?(String) storage = Google::APIClient::FileStorage.new(storage) end if storage.respond_to?(:load_credentials) && storage.respond_to?(:write_credentials) @token_storage = storage else raise "invalid storage" end end