Skip to content

Commit 41835ec

Browse files
author
Chris Wiechmann
authored
Merge pull request #9 from Axway-API-Builder-Ext/google-maps
Adding support for Google maps
2 parents 51640b6 + ba91ff7 commit 41835ec

39 files changed

+3945
-5
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# The name of the plugin to appear in the actions and badge!
2+
name: Google Maps Release
3+
4+
on:
5+
release:
6+
types:
7+
- published
8+
tags:
9+
# If this tag is pushed, a release is created
10+
- '*plugin-fn-google-maps*'
11+
12+
jobs:
13+
build:
14+
# This is a required check, as the on:release can't be filtered on given tags
15+
if: contains(github.ref, 'plugin-fn-google-maps')
16+
env:
17+
# This must be aligned with the folder-name of you plugin
18+
workingDirectory: 'api-builder-plugin-fn-google-maps'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v1
22+
- uses: actions/setup-node@v1
23+
with:
24+
node-version: 12
25+
- name: Run npm tests
26+
working-directory: ${{env.workingDirectory}}
27+
env:
28+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
29+
run: |
30+
npm ci
31+
npm test
32+
33+
publish-gpr:
34+
env:
35+
# This must be aligned with the folder-name of you plugin
36+
workingDirectory: 'api-builder-plugin-fn-google-maps'
37+
CI: true
38+
needs: build
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v1
42+
- uses: actions/setup-node@v1
43+
with:
44+
node-version: 12
45+
registry-url: https://npm.pkg.github.com/
46+
scope: '@Axway-API-Builder-Ext'
47+
- name: Publish to GitHub package repo
48+
working-directory: ${{env.workingDirectory}}
49+
env:
50+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
51+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
52+
run: |
53+
npm ci
54+
npm publish
55+
56+
publish-npm:
57+
env:
58+
# This must be aligned with the folder-name of you plugin
59+
workingDirectory: 'api-builder-plugin-fn-google-maps'
60+
CI: true
61+
needs: [build, publish-gpr]
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v1
65+
- uses: actions/setup-node@v1
66+
with:
67+
node-version: 12
68+
registry-url: https://registry.npmjs.org/
69+
- name: Publish to NPM package repo
70+
working-directory: ${{env.workingDirectory}}
71+
env:
72+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
73+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
74+
run: |
75+
npm ci
76+
echo "//registry.npmjs.org/:_authToken=${{ secrets.npm_token }}" > ~/.npmrc
77+
npm publish --access public
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# The name of the workflow node to appear in the actions and badge!
2+
name: Google Maps Tests
3+
4+
on:
5+
push:
6+
paths:
7+
# This must be aligned with the folder-name of you plugin
8+
- 'api-builder-plugin-fn-google-maps/**'
9+
- '.github/workflows/**'
10+
pull_request:
11+
paths:
12+
# This must be aligned with the folder-name of you plugin
13+
- 'api-builder-plugin-fn-google-maps/**'
14+
- '.github/workflows/**'
15+
16+
jobs:
17+
build:
18+
env:
19+
# This must be aligned with the folder-name of you plugin
20+
workingDirectory: 'api-builder-plugin-fn-google-maps'
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
node-version: [8.x, 10.x, 12.x]
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
- name: npm install, build, and test
32+
working-directory: ${{env.workingDirectory}}
33+
env:
34+
CI: true
35+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
36+
run: |
37+
npm ci
38+
npm run build --if-present
39+
npm test

api-builder-plugin-fn-aws-athena/src/actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const aws = require("aws-sdk");
1212
* @return {undefined}
1313
*/
1414
function query(req, outputs, options) {
15-
debugger;
1615
const awsConfig = this.pluginConfig.aws;
1716
const db = req.params.db;
1817
const table = req.params.table;

api-builder-plugin-fn-aws-athena/test/test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { MockRuntime } = require('@axway/api-builder-sdk');
33

44
const getPlugin = require('../src');
55
const actions = require('../src/actions');
6-
debugger;
76
const validPluginConfig = require('./config/aws-athena.testconfig').pluginConfig['@axway-api-builder-ext/api-builder-plugin-fn-aws-athena'];
87
const invalidPluginConfig = require('./config/aws-athena.incomplete').pluginConfig['@axway-api-builder-ext/api-builder-plugin-fn-aws-athena'];
98

@@ -116,7 +115,6 @@ describe('Valid PluginConfig tests', () => {
116115

117116
const result = await flowNode.query({ table: 'elb_logs', db: 'sampledb', fields: 'elb_name, request_ip'});
118117

119-
debugger;
120118
expect(result.callCount).to.equal(1);
121119
expect(result.output).to.equal('next');
122120
expect(result.args).to.be.an('Array');
@@ -131,7 +129,6 @@ describe('Valid PluginConfig tests', () => {
131129

132130
const result = await flowNode.query({ table: 'elb_logs', db: 'sampledb', fields: 'elb_name, request_port', limit: '1' });
133131

134-
debugger;
135132
expect(result.callCount).to.equal(1);
136133
expect(result.output).to.equal('next');
137134
expect(result.args).to.be.an('Array');
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# TypeScript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
# next.js build output
61+
.next
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
![Google Maps Tests](https://github.com/Axway-API-Builder-Ext/api-builder-extras/workflows/Google%20Maps%20Tests/badge.svg)
2+
3+
# API-Builder Google-Maps Connector
4+
5+
Integrate Google-Maps services into your [API-Builder flow][1] using this connector. Google-Maps Services are a number of APIs provided by Google and this connector helps you to integrate with them easily.
6+
7+
## Configuration
8+
9+
After installation and restarting your API-Builder project you get the following new flow-nodes:
10+
![Node][img1]
11+
Before you can make use it in your flow you have to configure your Google API-Key, which must be activated for the correct Google-APIs. Access the [Google Console][6] and learn more [here][7].
12+
13+
During installation a new config file has been automatically created which must be completed with your Google-API-Key. You can do that directly from within the API-Builder UI:
14+
![Config][img3]
15+
We recommend to setup your configuration in a [environmentalized][4] way keeping [sensitive information][5] away from the source-code repository.
16+
17+
## Google-Maps services
18+
This Connector is based on the https://github.com/googlemaps/google-maps-services-js project. It's a good starting point to understand the APIs and their parameters reading the following documentation:
19+
20+
- [Directions API](https://developers.google.com/maps/documentation/directions/start)
21+
- [Distance Matrix API](https://developers.google.com/maps/documentation/distance-matrix/start)
22+
- [Elevation API](https://developers.google.com/maps/documentation/elevation/)
23+
- [Geocoding API](https://developers.google.com/maps/documentation/geocoding/)
24+
- [Reverse Geocoding API](https://developers.google.com/maps/documentation/geocoding/start#reverse)
25+
- [Places API](https://developers.google.com/places/web-service/)
26+
27+
## Tests
28+
The connector is shipped with a number of Unit- and Integration tests. To execute the test-suite locally, please setup an environment variable:
29+
`GOOGLE_API_KEY=AIzaSyC...........Ws`
30+
And run the following command:
31+
`npm test`
32+
The tests are also automatically executed on every commit to this project.
33+
34+
## Compatibility
35+
Tested with Google-Maps Q1/2020
36+
Requires API-Builder Independence or higher
37+
38+
## Changelog
39+
- 1.0.0 - 21.02.2020
40+
- Initial version
41+
42+
## Limitations/Caveats
43+
The follow APIs are not yet supported:
44+
- Place Photos
45+
- Place Autocomplete
46+
- Query Autocomplete
47+
- Roads API
48+
- Time Zone API
49+
50+
If you require on the of the unsupported APIs don't hestitate to create an [issue][3]
51+
52+
## Contributing
53+
54+
Please read [Contributing.md](https://github.com/Axway-API-Management-Plus/Common/blob/master/Contributing.md) for details on our code of conduct, and the process for submitting pull requests to us.
55+
56+
## Team
57+
58+
![alt text][Axwaylogo] Axway Team
59+
60+
[Axwaylogo]: https://github.com/Axway-API-Management/Common/blob/master/img/AxwayLogoSmall.png "Axway logo"
61+
62+
[1]: https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_flows.html
63+
[2]: https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_getting_started_guide.html
64+
[3]: https://github.com/Axway-API-Builder-Ext/api-builder-extras/issues
65+
[4]: https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/environmentalization.html
66+
[5]: https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/project_configuration.html#ProjectConfiguration-Configurationfiles
67+
[6]: https://console.cloud.google.com
68+
[7]: https://developers.google.com/maps/documentation/javascript/get-api-key
69+
70+
[img1]: imgs/google-maps-flownode.png
71+
[img2]: imgs/google-maps-directions.png
72+
[img3]: imgs/google-maps-config.png
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
pluginConfig: {
3+
'@axway-api-builder-ext/api-builder-plugin-fn-google-maps': {
4+
'google': {
5+
credentials: {
6+
apiKey: process.env.GOOGLE_API_KEY
7+
}
8+
}
9+
}
10+
}
11+
};
8.77 KB
Loading
25.8 KB
Loading
4.33 KB
Loading

0 commit comments

Comments
 (0)