Skip to content

Commit eae1b7d

Browse files
integrate google-auth-library
1 parent 75c6874 commit eae1b7d

13 files changed

Lines changed: 957 additions & 555 deletions

File tree

.jshintrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@
1515
"strict": true,
1616
"trailing": true,
1717
"undef": true,
18-
"unused": true
18+
"unused": true,
19+
"globals": {
20+
"describe": true,
21+
"it": true,
22+
"before": true,
23+
"after": true,
24+
"beforeEach": true,
25+
"afterEach": true
26+
}
1927
}

docs/site/components/docs/docs.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,23 @@ <h3 class="sub-heading">
4343
</p>
4444
<div hljs>$ npm install --save gcloud</div>
4545
<div hljs>var gcloud = require('gcloud');</div>
46-
<p>
47-
There are a couple of ways to use the <code>gcloud</code> module.
48-
</p>
4946
<p>
5047
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.
5148
</p>
5249
<p>
53-
However, if you're running your app elsewhere, you will need to provide this information.
50+
However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.
5451
</p>
5552
<div hljs>
5653
// App Engine and Compute Engine
5754
var gcloud = require('gcloud');
5855

5956
// Elsewhere
6057
var gcloud = require('gcloud')({
58+
projectId: 'project-id',
6159
keyFilename: '/path/to/keyfile.json'
6260
});</div>
6361
<p>
64-
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.).
62+
The full set of options which can be passed to gcloud and sub-modules are <a href="#/docs/?method=gcloud">outlined here</a>.
6563
</p>
6664
</article>
6765
<hr>
@@ -85,7 +83,7 @@ <h3>Datastore Overview</h3>
8583
</p>
8684
<div hljs>
8785
var dataset = gcloud.datastore.dataset({
88-
projectId: 'myProject',
86+
projectId: 'project-id',
8987
keyFilename: '/path/to/keyfile.json'
9088
});</div>
9189
<p ng-if="!isActiveUrl('/docs/datastore/dataset')">
@@ -103,7 +101,7 @@ <h3>Pub/Sub Overview</h3>
103101
</p>
104102
<div hljs>
105103
var pubsub = gcloud.pubsub({
106-
projectId: 'myProject',
104+
projectId: 'project-id',
107105
keyFilename: '/path/to/keyfile.json'
108106
});</div>
109107
<p>

lib/bigquery/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,35 @@ var BIGQUERY_BASE_URL = 'https://www.googleapis.com/bigquery/v2/projects/';
6363
var SCOPES = ['https://www.googleapis.com/auth/bigquery'];
6464

6565
/**
66-
* The example below will demonstrate the different usage patterns your app may
66+
* The examples below will demonstrate the different usage patterns your app may
6767
* need to support to retrieve a BigQuery object.
6868
*
69+
* The full set of options that can be passed to BigQuery are
70+
* [outlined here](#/docs/?method=gcloud).
71+
*
6972
* @alias module:bigquery
7073
* @constructor
7174
*
7275
* @example
7376
* var gcloud = require('gcloud');
7477
*
78+
* //-
7579
* // Providing configuration details up-front.
80+
* //-
7681
* var myProject = gcloud({
7782
* keyFilename: '/path/to/keyfile.json',
7883
* projectId: 'my-project'
7984
* });
8085
*
8186
* var bigquery = myProject.bigquery();
8287
*
83-
*
88+
* //-
8489
* // Overriding default configuration details.
85-
* var anotherBigQueryInstance = myProject.bigquery({
90+
* //-
91+
* var bigquery = myProject.bigquery({
8692
* keyFilename: '/path/to/another/keyfile.json'
8793
* });
8894
*
89-
*
90-
* // Not using a default configuration.
91-
* var myOtherProject = gcloud.bigquery({
92-
* keyFilename: '/path/to/keyfile.json',
93-
* projectId: 'my-project'
94-
* });
95-
*
9695
* //-
9796
* // In the following examples from this page and the other modules (Dataset,
9897
* // Table, etc.), we are going to be using a dataset from
@@ -109,10 +108,11 @@ function BigQuery(options) {
109108

110109
options = options || {};
111110

112-
this.makeAuthorizedRequest_ = util.makeAuthorizedRequest({
111+
this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({
113112
credentials: options.credentials,
114113
keyFile: options.keyFilename,
115-
scopes: SCOPES
114+
scopes: SCOPES,
115+
email: options.email
116116
});
117117

118118
this.projectId = options.projectId;

0 commit comments

Comments
 (0)