Skip to content

Commit

Permalink
1.20.0 - create order by vintage year (#63)
Browse files Browse the repository at this point in the history
* 1.20.0 enable vintage year order creation

* 1.20.0 changelog
  • Loading branch information
rmody3 authored Apr 18, 2022
1 parent 4c1bfe2 commit 1851540
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
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.20.0] - 2022-04-18

### Added

- Adds optional `vintage_year` field to `order` creation

## [1.19.0] - 2022-04-11

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@patch-technology/patch",
"version": "1.19.0",
"version": "1.20.0",
"description": "Node.js wrapper for the Patch API",
"license": "MIT",
"repository": {
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.19.0'
'User-Agent': 'patch-node/1.20.0'
};

/**
Expand Down
9 changes: 9 additions & 0 deletions src/model/CreateOrderRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class CreateOrderRequest {
if (data.hasOwnProperty('state')) {
obj['state'] = ApiClient.convertToType(data['state'], 'String');
}

if (data.hasOwnProperty('vintage_year')) {
obj['vintage_year'] = ApiClient.convertToType(
data['vintage_year'],
'Number'
);
}
}
return obj;
}
Expand All @@ -58,4 +65,6 @@ CreateOrderRequest.prototype['metadata'] = undefined;

CreateOrderRequest.prototype['state'] = undefined;

CreateOrderRequest.prototype['vintage_year'] = undefined;

export default CreateOrderRequest;
9 changes: 9 additions & 0 deletions test/integration/orders.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,13 @@ describe('Orders Integration', function () {
expect(order.metadata).to.have.all.keys('external_id');
});
});

it('supports create orders with a vintage year', async function () {
const createOrderResponse = await patch.orders.createOrder({
mass_g: 100,
vintage_year: 2022
});

expect(createOrderResponse.success).to.equal(true);
});
});

0 comments on commit 1851540

Please sign in to comment.