Sha256: a0a1c459ed1fa7eeb49e4bb7c127680856c700f5f9dd10d83b662b27d8306148

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

module GoogleBigquery
  class Auth

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

    def initialize
      @config = GoogleBigquery::Config
      @key = Google::APIClient::KeyUtils.load_from_pkcs12(@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
      @client.retries = @config.retries.to_i if @config.retries.to_i > 1
      @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

2 entries across 2 versions & 1 rubygems

Version Path
bigbroda-0.0.6 lib/google_bigquery/auth.rb
bigbroda-0.0.5 lib/google_bigquery/auth.rb