From 5a555bb12e069bb0bfbea091158f517b1996a6a5 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 26 Mar 2019 21:51:41 -0700 Subject: [PATCH] fix: remove the plus samples --- samples/plus/post.js | 60 ------------------------------- test/samples/test.samples.plus.ts | 44 ----------------------- 2 files changed, 104 deletions(-) delete mode 100644 samples/plus/post.js delete mode 100644 test/samples/test.samples.plus.ts diff --git a/samples/plus/post.js b/samples/plus/post.js deleted file mode 100644 index 553ce0b7ed2..00000000000 --- a/samples/plus/post.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018, Google, LLC. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const {google} = require('googleapis'); -const sampleClient = require('../sampleclient'); - -const plus = google.plusDomains({ - version: 'v1', - auth: sampleClient.oAuth2Client, -}); - -async function runSample() { - const res = await plus.activities.insert({ - userId: 'me', - requestBody: { - object: { - originalContent: 'Hello from the Node.js Google API Client!', - }, - access: { - items: [ - { - type: 'domain', - }, - ], - domainRestricted: true, - }, - }, - }); - console.log(res.data); - return res.data; -} - -const scopes = [ - 'https://www.googleapis.com/auth/plus.me', - 'https://www.googleapis.com/auth/plus.stream.write', -]; - -if (module === require.main) { - sampleClient - .authenticate(scopes) - .then(runSample) - .catch(console.error); -} - -module.exports = { - runSample, - client: sampleClient.oAuth2Client, -}; diff --git a/test/samples/test.samples.plus.ts b/test/samples/test.samples.plus.ts deleted file mode 100644 index b736d68e360..00000000000 --- a/test/samples/test.samples.plus.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018, Google, LLC. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import * as assert from 'assert'; -import * as nock from 'nock'; -import {Utils} from './../utils'; - -nock.disableNetConnect(); - -// tslint:disable: no-any -const samples: any = { - post: require('../../../samples/plus/post'), -}; - -for (const p in samples) { - if (samples[p]) { - samples[p].client.credentials = {access_token: 'not-a-token'}; - } -} - -describe('plus samples', () => { - afterEach(() => { - nock.cleanAll(); - }); - - it('should insert a new activity', async () => { - const scope = nock(Utils.baseUrl) - .post(`/plusDomains/v1/people/me/activities`) - .reply(200, {}); - const data = await samples.post.runSample(); - assert(data); - scope.done(); - }); -});