Skip to content

Commit 21749d5

Browse files
committed
Include default billing plan info, fixes #16.
1 parent 87dc8dc commit 21749d5

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ JavaScript client for the openEO API.
44

55
[![Build Status](https://travis-ci.org/Open-EO/openeo-js-client.svg?branch=master)](https://travis-ci.org/Open-EO/openeo-js-client)
66

7-
This client is in **version 0.4.0-beta.1** and supports **openEO API versions 0.4.x**. Legacy versions are available as releases.
7+
This client is in **version 0.4.0-beta.2** and supports **openEO API versions 0.4**. Legacy versions are available as releases.
88

99
## Usage
1010
This library can run in a recent browser supporting ECMAScript 2015 or node.js.

openeo.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class OpenEO {
114114
* @returns {string} Version number (according to SemVer).
115115
*/
116116
static clientVersion() {
117-
return "0.4.0-beta.1";
117+
return "0.4.0-beta.2";
118118
}
119119

120120
}
@@ -1049,13 +1049,32 @@ class Capabilities {
10491049
return (this.data.billing && typeof this.data.billing.currency === 'string' ? this.data.billing.currency : null);
10501050
}
10511051

1052+
/**
1053+
* @typedef BillingPlan
1054+
* @type {Object}
1055+
* @property {string} name - Name of the billing plan.
1056+
* @property {string} description - A description of the billing plan, may include CommonMark syntax.
1057+
* @property {boolean} paid - `true` if it is a paid plan, otherwise `false`.
1058+
* @property {string} url - A URL pointing to a page describing the billing plan.
1059+
* @property {boolean} default - `true` if it is the default plan of the back-end, otherwise `false`.
1060+
*/
1061+
10521062
/**
10531063
* List all billing plans.
10541064
*
1055-
* @returns {object[]} Billing plans
1065+
* @returns {BillingPlan[]} Billing plans
10561066
*/
10571067
listPlans() {
1058-
return (this.data.billing && Array.isArray(this.data.billing.plans) ? this.data.billing.plans : []);
1068+
if (this.data.billing && Array.isArray(this.data.billing.plans)) {
1069+
var plans = this.data.billing.plans;
1070+
return plans.map(plan => {
1071+
plan.default = (typeof this.data.billing.default_plan === 'string' && this.data.billing.default_plan.toLowerCase() == plan.name.toLowerCase());
1072+
return plan;
1073+
});
1074+
}
1075+
else {
1076+
return [];
1077+
}
10591078
}
10601079
}
10611080

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openeo/js-client",
3-
"version": "0.4.0-beta.1",
3+
"version": "0.4.0-beta.2",
44
"author": "openEO Consortium",
55
"contributors": [
66
{

tests/earthengine.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ describe('With earth-engine-driver', () => {
88
const TESTBACKENDDIRECT = TESTBACKEND + '/v0.4';
99
const TESTUSERNAME = 'group5';
1010
const TESTPASSWORD = 'test123';
11-
const TESTCAPABILITIES = {"api_version":"0.4.0","backend_version":"0.4.0","title":"Google Earth Engine Proxy for openEO","description":"This is the Google Earth Engine Driver for openEO.\n\nGoogle Earth Engine is a planetary-scale platform for Earth science data & analysis. It is powered by Google's cloud infrastructure and combines a multi-petabyte catalog of satellite imagery and geospatial datasets with planetary-scale analysis capabilities. Google makes it available for scientists, researchers, and developers to detect changes, map trends, and quantify differences on the Earth's surface. Google Earth Engine is free for research, education, and nonprofit use.","endpoints":[{"path":"/","methods":["GET"]},{"path":"/service_types","methods":["GET"]},{"path":"/output_formats","methods":["GET"]},{"path":"/stac","methods":["GET"]},{"path":"/collections","methods":["GET"]},{"path":"/collections/{collection_id}","methods":["GET"]},{"path":"/processes","methods":["GET"]},{"path":"/files/{user_id}","methods":["GET"]},{"path":"/files/{user_id}/{path}","methods":["GET","PUT","DELETE"]},{"path":"/result","methods":["POST"]},{"path":"/jobs","methods":["POST","GET"]},{"path":"/jobs/{job_id}","methods":["GET","PATCH","DELETE"]},{"path":"/jobs/{job_id}/results","methods":["GET","POST"]},{"path":"/temp/{token}/{file}","methods":["GET"]},{"path":"/storage/{job_id}/{file}","methods":["GET"]},{"path":"/services","methods":["GET","POST"]},{"path":"/services/{service_id}","methods":["GET","PATCH","DELETE"]},{"path":"/xyz/{service_id}/{z}/{x}/{y}","methods":["GET"]},{"path":"/subscription","methods":["GET"]},{"path":"/credentials/basic","methods":["GET"]},{"path":"/credentials","methods":["POST"]},{"path":"/me","methods":["GET"]},{"path":"/validation","methods":["POST"]},{"path":"/process_graphs","methods":["GET","POST"]},{"path":"/process_graphs/{process_graph_id}","methods":["GET","PATCH","DELETE"]}],"billing":{"currency":"USD","default_plan":"free","plans":[{"name":"free","description":"Earth Engine is free for research, education, and nonprofit use. For commercial applications, Google offers paid commercial licenses. Please contact earthengine-commercial@google.com for details.","paid":false}]},"links":[{"rel":"about","href":"https://earthengine.google.com/","title":"Google Earth Engine Homepage"},{"rel":"related","href":"https://github.com/Open-EO/openeo-earthengine-driver","title":"GitHub repository"},{"rel":"version-history","href":TESTBACKEND+"/.well-known/openeo","type":"application/json","title":"Supported API versions"}]};
11+
const FREE_PLAN = {"name":"free","description":"Earth Engine is free for research, education, and nonprofit use. For commercial applications, Google offers paid commercial licenses. Please contact earthengine-commercial@google.com for details.","paid":false,"default":true};
12+
const TESTCAPABILITIES = {"api_version":"0.4.0","backend_version":"0.4.0","title":"Google Earth Engine Proxy for openEO","description":"This is the Google Earth Engine Driver for openEO.\n\nGoogle Earth Engine is a planetary-scale platform for Earth science data & analysis. It is powered by Google's cloud infrastructure and combines a multi-petabyte catalog of satellite imagery and geospatial datasets with planetary-scale analysis capabilities. Google makes it available for scientists, researchers, and developers to detect changes, map trends, and quantify differences on the Earth's surface. Google Earth Engine is free for research, education, and nonprofit use.","endpoints":[{"path":"/","methods":["GET"]},{"path":"/service_types","methods":["GET"]},{"path":"/output_formats","methods":["GET"]},{"path":"/stac","methods":["GET"]},{"path":"/collections","methods":["GET"]},{"path":"/collections/{collection_id}","methods":["GET"]},{"path":"/processes","methods":["GET"]},{"path":"/files/{user_id}","methods":["GET"]},{"path":"/files/{user_id}/{path}","methods":["GET","PUT","DELETE"]},{"path":"/result","methods":["POST"]},{"path":"/jobs","methods":["POST","GET"]},{"path":"/jobs/{job_id}","methods":["GET","PATCH","DELETE"]},{"path":"/jobs/{job_id}/results","methods":["GET","POST"]},{"path":"/temp/{token}/{file}","methods":["GET"]},{"path":"/storage/{job_id}/{file}","methods":["GET"]},{"path":"/services","methods":["GET","POST"]},{"path":"/services/{service_id}","methods":["GET","PATCH","DELETE"]},{"path":"/xyz/{service_id}/{z}/{x}/{y}","methods":["GET"]},{"path":"/subscription","methods":["GET"]},{"path":"/credentials/basic","methods":["GET"]},{"path":"/credentials","methods":["POST"]},{"path":"/me","methods":["GET"]},{"path":"/validation","methods":["POST"]},{"path":"/process_graphs","methods":["GET","POST"]},{"path":"/process_graphs/{process_graph_id}","methods":["GET","PATCH","DELETE"]}],"billing":{"currency":"USD","default_plan":"free","plans":[FREE_PLAN]},"links":[{"rel":"about","href":"https://earthengine.google.com/","title":"Google Earth Engine Homepage"},{"rel":"related","href":"https://github.com/Open-EO/openeo-earthengine-driver","title":"GitHub repository"},{"rel":"version-history","href":TESTBACKEND+"/.well-known/openeo","type":"application/json","title":"Supported API versions"}]};
1213
const TESTCOLLECTION = {"id":"AAFC/ACI","title":"Canada AAFC Annual Crop Inventory","description":"Starting in 2009, the Earth Observation Team of the Science and Technology\nBranch (STB) at Agriculture and Agri-Food Canada (AAFC) began the process\nof generating annual crop type digital maps. Focusing on the Prairie\nProvinces in 2009 and 2010, a Decision Tree (DT) based methodology was\napplied using optical (Landsat-5, AWiFS, DMC) and radar (Radarsat-2) based\nsatellite images. Beginning with the 2011 growing season, this activity has\nbeen extended to other provinces in support of a national crop inventory.\nTo date this approach can consistently deliver a crop inventory that meets\nthe overall target accuracy of at least 85% at a final spatial resolution of\n30m (56m in 2009 and 2010).\n","license":"proprietary","providers":[{"name":"Agriculture and Agri-Food Canada","roles":["producer","licensor"],"url":"https://open.canada.ca/data/en/dataset/ba2645d5-4458-414d-b196-6303ac06c1c9"},{"name":"Google Earth Engine","roles":["host"],"url":"https://developers.google.com/earth-engine/datasets/catalog/AAFC_ACI"}],"extent":{"spatial":[-135.17,36.83,-51.24,62.25],"temporal":["2009-01-01T00:00:00Z",null]},"links":[{"rel":"self","href":TESTBACKENDDIRECT+"/collections/AAFC/ACI"},{"rel":"parent","href":TESTBACKENDDIRECT+"/collections"},{"rel":"root","href":TESTBACKENDDIRECT+"collections"},{"rel":"source","href":"http://www.agr.gc.ca/atlas/data_donnees/agr/annualCropInventory/tif"}]};
1314
const TESTPROCESS = {"id":"min","summary":"Minimum value","description":"Computes the smallest value of an array of numbers, which is is equal to the last element of a sorted (i.e., ordered) version the array.","categories":["math","reducer"],"gee:custom":true,"parameters":{"data":{"description":"An array of numbers. An empty array resolves always with `null`.","schema":{"type":"array","items":{"type":["number","null"]}},"required":true}},"returns":{"description":"The minimum value.","schema":{"type":["number","null"]}},"examples":[{"arguments":{"data":[1,0,3,2]},"returns":0},{"arguments":{"data":[5,2.5,null,-0.7]},"returns":-0.7},{"arguments":{"data":[]},"returns":null}],"links":[{"rel":"about","href":"http://mathworld.wolfram.com/Minimum.html","title":"Minimum explained by Wolfram MathWorld"}]};
1415
const TESTPROCESSGGRAPH = {"1":{"process_id":"load_collection","arguments":{"id":"COPERNICUS/S2","spatial_extent":{"west":-2.763447,"south":43.040791,"east":-1.120991,"north":43.838489},"temporal_extent":["2018-04-30","2018-06-26"],"bands":["B4","B8"]}},"2":{"process_id":"filter_bands","arguments":{"data":{"from_node":1},"bands":["B4"]}},"3":{"process_id":"normalized_difference","arguments":{"band1":{"from_node":2},"band2":{"from_node":6}}},"4":{"process_id":"reduce","arguments":{"data":{"from_node":3},"reducer":{"callback":{"min":{"arguments":{"data":{"from_argument":"data"}},"process_id":"min","result":true}}},"dimension":"temporal"}},"5":{"process_id":"save_result","arguments":{"data":{"from_node":4},"format":"png"},"result":true},"6":{"process_id":"filter_bands","arguments":{"data":{"from_node":1},"bands":["B8"]}}};
@@ -113,7 +114,6 @@ describe('With earth-engine-driver', () => {
113114
var caps = await con.capabilities();
114115
expect(caps).not.toBeNull();
115116
expect(Object.getPrototypeOf(caps).constructor.name).toBe('Capabilities');
116-
expect(caps.data).toEqual(TESTCAPABILITIES);
117117
expect(caps.apiVersion()).toBe(TESTCAPABILITIES.api_version);
118118
expect(caps.backendVersion()).toBe(TESTCAPABILITIES.backend_version);
119119
expect(caps.title()).toBe(TESTCAPABILITIES.title);

0 commit comments

Comments
 (0)