Skip to content

Commit

Permalink
integrate google-auth-library
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Apr 6, 2015
1 parent 75c6874 commit eae1b7d
Show file tree
Hide file tree
Showing 13 changed files with 957 additions and 555 deletions.
10 changes: 9 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@
"strict": true,
"trailing": true,
"undef": true,
"unused": true
"unused": true,
"globals": {
"describe": true,
"it": true,
"before": true,
"after": true,
"beforeEach": true,
"afterEach": true
}
}
12 changes: 5 additions & 7 deletions docs/site/components/docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,23 @@ <h3 class="sub-heading">
</p>
<div hljs>$ npm install --save gcloud</div>
<div hljs>var gcloud = require('gcloud');</div>
<p>
There are a couple of ways to use the <code>gcloud</code> module.
</p>
<p>
If you are running your app on Google App Engine or Google Compute Engine, you won't need to worry about supplying connection configuration options to <code>gcloud</code>&mdash; we figure that out for you.
</p>
<p>
However, if you're running your app elsewhere, you will need to provide this information.
However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.
</p>
<div hljs>
// App Engine and Compute Engine
var gcloud = require('gcloud');

// Elsewhere
var gcloud = require('gcloud')({
projectId: 'project-id',
keyFilename: '/path/to/keyfile.json'
});</div>
<p>
In any environment, you are free to provide these and other default properties, which eventually will be passed to the <code>gcloud</code> sub-modules (Datastore, Storage, etc.).
The full set of options which can be passed to gcloud and sub-modules are <a href="#/docs/?method=gcloud">outlined here</a>.
</p>
</article>
<hr>
Expand All @@ -85,7 +83,7 @@ <h3>Datastore Overview</h3>
</p>
<div hljs>
var dataset = gcloud.datastore.dataset({
projectId: 'myProject',
projectId: 'project-id',
keyFilename: '/path/to/keyfile.json'
});</div>
<p ng-if="!isActiveUrl('/docs/datastore/dataset')">
Expand All @@ -103,7 +101,7 @@ <h3>Pub/Sub Overview</h3>
</p>
<div hljs>
var pubsub = gcloud.pubsub({
projectId: 'myProject',
projectId: 'project-id',
keyFilename: '/path/to/keyfile.json'
});</div>
<p>
Expand Down
24 changes: 12 additions & 12 deletions lib/bigquery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,35 @@ var BIGQUERY_BASE_URL = 'https://www.googleapis.com/bigquery/v2/projects/';
var SCOPES = ['https://www.googleapis.com/auth/bigquery'];

/**
* The example below will demonstrate the different usage patterns your app may
* The examples below will demonstrate the different usage patterns your app may
* need to support to retrieve a BigQuery object.
*
* The full set of options that can be passed to BigQuery are
* [outlined here](#/docs/?method=gcloud).
*
* @alias module:bigquery
* @constructor
*
* @example
* var gcloud = require('gcloud');
*
* //-
* // Providing configuration details up-front.
* //-
* var myProject = gcloud({
* keyFilename: '/path/to/keyfile.json',
* projectId: 'my-project'
* });
*
* var bigquery = myProject.bigquery();
*
*
* //-
* // Overriding default configuration details.
* var anotherBigQueryInstance = myProject.bigquery({
* //-
* var bigquery = myProject.bigquery({
* keyFilename: '/path/to/another/keyfile.json'
* });
*
*
* // Not using a default configuration.
* var myOtherProject = gcloud.bigquery({
* keyFilename: '/path/to/keyfile.json',
* projectId: 'my-project'
* });
*
* //-
* // In the following examples from this page and the other modules (Dataset,
* // Table, etc.), we are going to be using a dataset from
Expand All @@ -109,10 +108,11 @@ function BigQuery(options) {

options = options || {};

this.makeAuthorizedRequest_ = util.makeAuthorizedRequest({
this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES
scopes: SCOPES,
email: options.email
});

this.projectId = options.projectId;
Expand Down
Loading

0 comments on commit eae1b7d

Please sign in to comment.