Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all modules: ensure all User-Agents are set #1568

Merged
merged 7 commits into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bigquery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"bigquery"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arrify": "^1.0.0",
"duplexify": "^3.2.0",
"extend": "^3.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/bigquery/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ var Job = require('./job.js');
*/
var Table = require('./table.js');

var PKG = require('../package.json');

/**
* 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 @@ -69,7 +67,7 @@ function BigQuery(options) {
var config = {
baseUrl: 'https://www.googleapis.com/bigquery/v2',
scopes: ['https://www.googleapis.com/auth/bigquery'],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.Service.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/bigquery/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ var Service = require('@google-cloud/common').Service;
var Table = require('../src/table.js');
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var fakeUtil = extend({}, util);

function FakeTable(a, b) {
Expand Down Expand Up @@ -118,7 +116,7 @@ describe('BigQuery', function() {
assert.deepEqual(calledWith.scopes, [
'https://www.googleapis.com/auth/bigquery'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/bigtable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"bigtable"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arrify": "^1.0.0",
"concat-stream": "^1.5.0",
"create-error-class": "^3.0.2",
Expand Down
12 changes: 5 additions & 7 deletions packages/bigtable/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ var util = require('util');

/**
* @private
* @type {module:bigtable/instance}
* @type {module:bigtable/cluster}
*/
var Instance = require('./instance.js');
var Cluster = require('./cluster.js');

/**
* @private
* @type {module:bigtable/cluster}
* @type {module:bigtable/instance}
*/
var Cluster = require('./cluster.js');

var PKG = require('../package.json');
var Instance = require('./instance.js');

/**
* @alias module:bigtable
Expand Down Expand Up @@ -319,7 +317,7 @@ function Bigtable(options) {
'https://www.googleapis.com/auth/bigtable.data',
'https://www.googleapis.com/auth/cloud-platform'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.GrpcService.call(this, config, options);
Expand Down
3 changes: 1 addition & 2 deletions packages/bigtable/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var sinon = require('sinon').sandbox.create();
var common = require('@google-cloud/common');
var Cluster = require('../src/cluster.js');
var Instance = require('../src/instance.js');
var PKG = require('../package.json');

var fakeUtil = extend({}, common.util);
var fakeStreamRouter = {
Expand Down Expand Up @@ -143,7 +142,7 @@ describe('Bigtable', function() {
'https://www.googleapis.com/auth/cloud-platform'
]);

assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});

it('should set the projectName', function() {
Expand Down
2 changes: 1 addition & 1 deletion packages/compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"compute engine"
],
"dependencies": {
"@google-cloud/common": "^0.1.0",
"@google-cloud/common": "^0.5.0",
"arrify": "^1.0.0",
"async": "^1.4.2",
"create-error-class": "^2.0.1",
Expand Down
4 changes: 1 addition & 3 deletions packages/compute/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ var Snapshot = require('./snapshot.js');
*/
var Zone = require('./zone.js');

var PKG = require('../package.json');

/**
* @alias module:compute
* @constructor
Expand All @@ -99,7 +97,7 @@ function Compute(options) {
var config = {
baseUrl: 'https://www.googleapis.com/compute/v1',
scopes: ['https://www.googleapis.com/auth/compute'],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.Service.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/compute/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ var proxyquire = require('proxyquire');
var Service = require('@google-cloud/common').Service;
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var slice = Array.prototype.slice;

var fakeUtil = extend({}, util, {
Expand Down Expand Up @@ -183,7 +181,7 @@ describe('Compute', function() {
assert.deepEqual(calledWith.scopes, [
'https://www.googleapis.com/auth/compute'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"datastore"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arrify": "^1.0.0",
"concat-stream": "^1.5.0",
"create-error-class": "^3.0.2",
Expand Down
4 changes: 1 addition & 3 deletions packages/datastore/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ var Query = require('./query.js');
*/
var Transaction = require('./transaction.js');

var PKG = require('../package.json');

/**
* @constructor
* @alias module:datastore
Expand Down Expand Up @@ -323,7 +321,7 @@ function Datastore(options) {
service: 'datastore',
apiVersion: 'v1',
scopes: ['https://www.googleapis.com/auth/datastore'],
userAgent: PKG.name + '/' + PKG.version,
packageJson: require('../package.json'),
grpcMetadata: {
'google-cloud-resource-prefix': 'projects/' + this.projectId
}
Expand Down
4 changes: 1 addition & 3 deletions packages/datastore/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ var extend = require('extend');
var proxyquire = require('proxyquire');
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var fakeEntity = {
Int: function(value) {
this.value = value;
Expand Down Expand Up @@ -157,7 +155,7 @@ describe('Datastore', function() {
assert.deepEqual(calledWith.scopes, [
'https://www.googleapis.com/auth/datastore'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
assert.deepEqual(calledWith.grpcMetadata, {
'google-cloud-resource-prefix': 'projects/' + datastore.projectId
});
Expand Down
2 changes: 1 addition & 1 deletion packages/dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dns"
],
"dependencies": {
"@google-cloud/common": "^0.1.0",
"@google-cloud/common": "^0.5.0",
"arrify": "^1.0.0",
"dns-zonefile": "0.1.18",
"extend": "^3.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/dns/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ var util = require('util');
*/
var Zone = require('./zone.js');

var PKG = require('../package.json');

/**
* [Google Cloud DNS](https://cloud.google.com/dns/what-is-cloud-dns) is a high-
* performance, resilient, global DNS service that provides a cost-effective way
Expand All @@ -60,7 +58,7 @@ function DNS(options) {
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
'https://www.googleapis.com/auth/cloud-platform'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.Service.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/dns/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var proxyquire = require('proxyquire');
var Service = require('@google-cloud/common').Service;
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var extended = false;
var fakeStreamRouter = {
extend: function(Class, methods) {
Expand Down Expand Up @@ -113,7 +111,7 @@ describe('DNS', function() {
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
'https://www.googleapis.com/auth/cloud-platform'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"language"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arguejs": "^0.2.3",
"arrify": "^1.0.1",
"extend": "^3.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/language/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ var util = require('util');
*/
var Document = require('./document.js');

var PKG = require('../package.json');

/**
* <p class="notice">
* **This is a Beta release of Google Cloud Natural Language.** This API is
Expand Down Expand Up @@ -79,7 +77,7 @@ function Language(options) {
scopes: [
'https://www.googleapis.com/auth/cloud-platform'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.GrpcService.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/language/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ var googleProtoFiles = require('google-proto-files');
var proxyquire = require('proxyquire');
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var fakeUtil = extend(true, {}, util);

function FakeDocument() {
Expand Down Expand Up @@ -98,7 +96,7 @@ describe('Language', function() {
scopes: [
'https://www.googleapis.com/auth/cloud-platform'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"stackdriver"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arguejs": "^0.2.3",
"arrify": "^1.0.0",
"extend": "^3.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/logging/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ var Log = require('./log.js');
*/
var Sink = require('./sink.js');

var PKG = require('../package.json');

/**
* <p class="notice">
* **This is a Beta release of Stackdriver Logging.** This API is not covered
Expand Down Expand Up @@ -85,7 +83,7 @@ function Logging(options) {
scopes: [
'https://www.googleapis.com/auth/cloud-platform'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.GrpcService.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/logging/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ var googleProtoFiles = require('google-proto-files');
var proxyquire = require('proxyquire');
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

var extended = false;
var fakeStreamRouter = {
extend: function(Class, methods) {
Expand Down Expand Up @@ -147,7 +145,7 @@ describe('Logging', function() {
assert.deepEqual(calledWith.scopes, [
'https://www.googleapis.com/auth/cloud-platform'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/prediction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"prediction"
],
"dependencies": {
"@google-cloud/common": "^0.1.0",
"@google-cloud/common": "^0.5.0",
"JSONStream": "^1.0.7",
"arrify": "^1.0.0",
"extend": "^3.0.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/prediction/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ var util = require('util');
*/
var Model = require('./model.js');

var PKG = require('../package.json');

/**
* The [Google Prediction API](https://cloud.google.com/prediction/docs/getting-started)
* provides pattern-matching and machine learning capabilities. Given a set of
Expand Down Expand Up @@ -70,7 +68,7 @@ function Prediction(options) {
'https://www.googleapis.com/auth/prediction',
'https://www.googleapis.com/auth/devstorage.read_only'
],
userAgent: PKG.name + '/' + PKG.version
packageJson: require('../package.json')
};

common.Service.call(this, config, options);
Expand Down
4 changes: 1 addition & 3 deletions packages/prediction/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ var proxyquire = require('proxyquire');
var Service = require('@google-cloud/common').Service;
var util = require('@google-cloud/common').util;

var PKG = require('../package.json');

function FakeModel() {
this.calledWith_ = arguments;
}
Expand Down Expand Up @@ -114,7 +112,7 @@ describe('Prediction', function() {
'https://www.googleapis.com/auth/prediction',
'https://www.googleapis.com/auth/devstorage.read_only'
]);
assert.strictEqual(calledWith.userAgent, PKG.name + '/' + PKG.version);
assert.deepEqual(calledWith.packageJson, require('../package.json'));
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"pubsub"
],
"dependencies": {
"@google-cloud/common": "^0.4.0",
"@google-cloud/common": "^0.5.0",
"arguejs": "^0.2.3",
"arrify": "^1.0.0",
"extend": "^3.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/pubsub/src/iam.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ function IAM(pubsub, id) {
scopes: [
'https://www.googleapis.com/auth/pubsub',
'https://www.googleapis.com/auth/cloud-platform'
]
],
packageJson: require('../package.json')
};

this.id = id;
Expand Down
Loading