Skip to content

Commit

Permalink
Add verifier to projects (#50)
Browse files Browse the repository at this point in the history
* Add verifier to projects

* Update dependency
  • Loading branch information
pcothenet authored Nov 4, 2021
1 parent 7c59662 commit 8ab0f68
Show file tree
Hide file tree
Showing 9 changed files with 1,203 additions and 4,431 deletions.
4 changes: 3 additions & 1 deletion .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require: '@babel/register'
recursive: true
timeout: '10000'
recursive: true
spec:
- 'test/**/*.test.js'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.15.1] - 2021-11-04

### Added

- Adds verifier to project responses

## [1.15.0] - 2021-10-04

### Added
Expand Down
5,588 changes: 1,175 additions & 4,413 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"name": "@patch-technology/patch",
"version": "1.15.0",
"version": "1.15.1",
"description": "Node.js wrapper for the Patch API",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/patch-technology/patch-node.git"
},
"main": "dist/index.js",
"scripts": {
"build": "babel src -d dist",
"prepare": "npm run build",
"test": "mocha"
},
"browser": {
"fs": false
},
Expand All @@ -30,8 +25,8 @@
"superagent": "^5.3.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
Expand All @@ -48,12 +43,12 @@
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"chai": "^4.2.0",
"@babel/preset-env": "^7.16.0",
"@babel/register": "^7.16.0",
"chai": "^4.3.0",
"husky": "^4.2.5",
"lint-staged": "^10.5.4",
"mocha": "^8.1.0",
"mocha": "^9.1.0",
"sinon": "^7.2.0",
"prettier": "^2.0.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ApiClient {
};

this.defaultHeaders = {
'User-Agent': 'patch-node/1.15.0'
'User-Agent': 'patch-node/1.15.1'
};

/**
Expand Down
6 changes: 6 additions & 0 deletions src/model/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ class Project {
);
}

if (data.hasOwnProperty('verifier')) {
obj['verifier'] = ApiClient.convertToType(data['verifier'], 'String');
}

if (data.hasOwnProperty('standard')) {
obj['standard'] = ApiClient.convertToType(data['standard'], Standard);
}
Expand Down Expand Up @@ -182,6 +186,8 @@ Project.prototype['average_price_per_tonne_cents_usd'] = undefined;

Project.prototype['remaining_mass_g'] = undefined;

Project.prototype['verifier'] = undefined;

Project.prototype['standard'] = undefined;

Project.prototype['sdgs'] = undefined;
Expand Down
6 changes: 4 additions & 2 deletions test/integration/orders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('Orders Integration', function () {

it('supports placing orders in a `draft` state', async function () {
const estimateResponse = await patch.estimates.createMassEstimate({
mass_g: 100
mass_g: 100,
create_order: true
});
const orderId = estimateResponse.data.order.id;
expect(estimateResponse.data.order.state).to.equal('draft');
Expand All @@ -41,7 +42,8 @@ describe('Orders Integration', function () {

it('supports cancelling orders in a `draft` state', async function () {
const estimateResponse = await patch.estimates.createMassEstimate({
mass_g: 100
mass_g: 100,
create_order: true
});
const orderId = estimateResponse.data.order.id;
expect(estimateResponse.data.order.state).to.equal('draft');
Expand Down
1 change: 0 additions & 1 deletion test/integration/projects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('Project Integration', function () {
expect(projectResponse.data).to.be.have.property('tagline');

expect(projectResponse.data.mechanism).to.be.a('string');
expect(projectResponse.data.state).to.be.a('string');
expect(projectResponse.data.latitude).to.be.a('number');
expect(projectResponse.data.longitude).to.be.a('number');

Expand Down
2 changes: 1 addition & 1 deletion test/integration/projects/technology_types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Patch from '../../../dist/index';
const patch = Patch(process.env.SANDBOX_API_KEY);

describe('Projects TechnologyTypes Integration', function () {
it.only('supports fetching the available technology_types', async function () {
it('supports fetching the available technology_types', async function () {
const { data } = await patch.technologytypes.retrieveTechnologyTypes();
expect(data.length).to.be.above(0);
expect(data[0].name).to.be.a('string');
Expand Down

0 comments on commit 8ab0f68

Please sign in to comment.