Class: GoogleBigquery::Auth
- Inherits:
-
Object
- Object
- GoogleBigquery::Auth
- Defined in:
- lib/google_bigquery/auth.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize ⇒ Auth
Returns a new instance of Auth.
7 8 9 10 11 |
# File 'lib/google_bigquery/auth.rb', line 7 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 |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
4 5 6 |
# File 'lib/google_bigquery/auth.rb', line 4 def api @api end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/google_bigquery/auth.rb', line 4 def client @client end |
Class Method Details
.authorized? ⇒ Boolean
22 23 24 |
# File 'lib/google_bigquery/auth.rb', line 22 def self. client.present? end |
Instance Method Details
#authorize ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/google_bigquery/auth.rb', line 13 def @client = Google::APIClient.new(application_name: "BigBroda", application_version: GoogleBigquery::VERSION ) @client. = @asserter. @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 |