Sha256: 76ddad4e6bd2ca8a2d5d8d571068db66023be467d2b7b54751e4e20144cc470b

Contents?: true

Size: 642 Bytes

Versions: 4

Compression:

Stored size: 642 Bytes

Contents

module GoogleBigquery
  class Auth

    attr_accessor :api, :client
    cattr_accessor :api, :client

    def initialize
      config = GoogleBigquery::Config
      @key = Google::APIClient::PKCS12.load_key(config.key_file, config.pass_phrase)
      @asserter = Google::APIClient::JWTAsserter.new( config.email, config.scope, @key)
    end

    def authorize
      @client = Google::APIClient.new()
      @client.authorization = @asserter.authorize()
      @api = @client.discovered_api("bigquery",'v2')
      self.class.api = @api
      self.class.client = @client
    end

    def self.authorized?
      client.present?
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bigbroda-0.0.4 lib/google_bigquery/auth.rb
bigbroda-0.0.3 lib/google_bigquery/auth.rb
bigbroda-0.0.2 lib/google_bigquery/auth.rb
bigbroda-0.0.1 lib/google_bigquery/auth.rb