Skip to content

Commit 13a78c2

Browse files
committed
Updated version number, changed from UNPKG to jsDelivr - UNPKG had to many downtimes recently.
1 parent 6438a02 commit 13a78c2

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ This library can run in a recent browser supporting ECMAScript 2015 or node.js.
1111

1212
To use it in a browser environment simply add the following code to your HTML file:
1313
```
14-
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
15-
<script src="https://unpkg.com/@openeo/js-client/openeo.js"></script>
14+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
15+
<script src="https://cdn.jsdelivr.net/npm/@openeo/js-client/openeo.js"></script>
1616
```
1717

1818
To install it with npm: `npm install @openeo/js-client`

examples/discovery.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<title>openEO JS client - Discovery example</title>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
7+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
88
<script src="../openeo.js"></script>
99
<script type="text/javascript">
1010
var url = "https://earthengine.openeo.org/v0.3"; // Insert the openEO server URL here

openeo.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class OpenEO {
3535
}
3636

3737
version() {
38-
return "0.3.0";
38+
return "0.3.2";
3939
}
4040
}
4141

@@ -568,15 +568,19 @@ class Capabilities {
568568
if(!data || !data.version || !data.endpoints) {
569569
throw new Error("Data is not a valid Capabilities response");
570570
}
571-
this._data = data;
571+
this.data = data;
572+
}
573+
574+
toPlainObject() {
575+
return this.data;
572576
}
573577

574578
version() {
575-
return this._data.version;
579+
return this.data.version;
576580
}
577581

578582
listFeatures() {
579-
return this._data.endpoints;
583+
return this.data.endpoints;
580584
}
581585

582586
hasFeature(methodName) {
@@ -628,7 +632,7 @@ class Capabilities {
628632
if (methodName === 'createFile') {
629633
return this.hasFeature('uploadFile'); // createFile is always available, map it to uploadFile as it is more meaningful.
630634
} else {
631-
return this._data.endpoints
635+
return this.data.endpoints
632636
.map((e) => e.methods.map((method) => method + ' ' + e.path))
633637
// .flat(1) // does exactly what we want, but (as of Sept. 2018) not yet part of the standard...
634638
.reduce((a, b) => a.concat(b), []) // ES6-proof version of flat(1)
@@ -637,11 +641,11 @@ class Capabilities {
637641
}
638642

639643
currency() {
640-
return (this._data.billing ? this._data.billing.currency : null);
644+
return (this.data.billing ? this.data.billing.currency : null);
641645
}
642646

643647
listPlans() {
644-
return (this._data.billing ? this._data.billing.plans : null);
648+
return (this.data.billing ? this.data.billing.plans : null);
645649
}
646650
}
647651

tests/basic.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { OpenEO } = require('../openeo.js');
2+
const packageInfo = require('../package.json');
23

34
describe('Basic client tests', () => {
45
var obj = new OpenEO();
@@ -7,6 +8,6 @@ describe('Basic client tests', () => {
78
expect(obj).toBeInstanceOf(OpenEO);
89
});
910
test('Check version number', () => {
10-
expect(obj.version()).toBe("0.3.0");
11+
expect(obj.version()).toBe(packageInfo.version);
1112
});
1213
});

0 commit comments

Comments
 (0)