Skip to content

Commit e895ca2

Browse files
authored
Correct history for issued_to + fix changelog for Estimates (#73)
* Round 2 * Bump version and fix changelog * Remove unused model * Revert * update test * Fix * Tweak * Consolidate
1 parent 9de03b4 commit e895ca2

File tree

11 files changed

+2180
-2202
lines changed

11 files changed

+2180
-2202
lines changed

CHANGELOG.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- Adds `patch.estimates.create_air_shipping_estimate` method
13-
- Adds `patch.estimates.create_rail_shipping_estimate` method
14-
- Adds `patch.estimates.create_road_shipping_estimate` method
15-
- Adds `patch.estimates.create_sea_shipping_estimate` method
12+
- Adds `patch.estimates.createAirShippingEstimate` method
13+
- Adds `patch.estimates.createRailShippingEstimate` method
14+
- Adds `patch.estimates.createRoadShippingEstimate` method
15+
- Adds `patch.estimates.createSeaShippingEstimate` method
16+
17+
### Breaking
18+
19+
- Renames the `issuedTo` parameter for `orders` to `issued_to`.
1620

1721
## [1.23.0] - 2022-06-03
1822

1923
### Added
2024

21-
- Adds support for the `issued_to` parameter on `orders`, to add support for creating and placing orders on behalf of another party.
25+
- Adds support for the `issuedTo` parameter on `orders`, to add support for creating and placing orders on behalf of another party.
2226

2327
## [1.22.0] - 2022-05-16
2428

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@patch-technology/patch",
3-
"version": "1.24.0",
3+
"version": "1.24.1",
44
"description": "Node.js wrapper for the Patch API",
55
"license": "MIT",
66
"repository": {

src/ApiClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ApiClient {
1616
};
1717

1818
this.defaultHeaders = {
19-
'User-Agent': 'patch-node/1.24.0'
19+
'User-Agent': 'patch-node/1.24.1'
2020
};
2121

2222
/**

src/model/CreateOrderRequest.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import ApiClient from '../ApiClient';
9-
import V1OrdersIssuedTo from './V1OrdersIssuedTo';
9+
import OrderIssuedTo from './OrderIssuedTo';
1010

1111
class CreateOrderRequest {
1212
constructor() {
@@ -71,10 +71,8 @@ class CreateOrderRequest {
7171
obj['unit'] = ApiClient.convertToType(data['unit'], 'String');
7272
}
7373

74-
if (data.hasOwnProperty('issuedTo')) {
75-
obj['issued_to'] = V1OrdersIssuedTo.constructFromObject(
76-
data['issuedTo']
77-
);
74+
if (data.hasOwnProperty('issued_to')) {
75+
obj['issued_to'] = OrderIssuedTo.constructFromObject(data['issued_to']);
7876
}
7977
}
8078
return obj;

src/model/Order.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import ApiClient from '../ApiClient';
99
import Allocation from './Allocation';
10-
import IssuedTo from './IssuedTo';
1110
import OrderInventory from './OrderInventory';
11+
import OrderIssuedTo from './OrderIssuedTo';
1212

1313
class Order {
1414
constructor(
@@ -167,7 +167,7 @@ class Order {
167167
}
168168

169169
if (data.hasOwnProperty('issued_to')) {
170-
obj['issued_to'] = IssuedTo.constructFromObject(data['issued_to']);
170+
obj['issued_to'] = OrderIssuedTo.constructFromObject(data['issued_to']);
171171
}
172172
}
173173
return obj;

src/model/IssuedTo.js renamed to src/model/OrderIssuedTo.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
import ApiClient from '../ApiClient';
99

10-
class IssuedTo {
10+
class OrderIssuedTo {
1111
constructor() {
12-
IssuedTo.initialize(this);
12+
OrderIssuedTo.initialize(this);
1313
}
1414

1515
static initialize(obj) {}
1616

1717
static constructFromObject(data, obj) {
1818
if (data) {
19-
obj = obj || new IssuedTo();
19+
obj = obj || new OrderIssuedTo();
2020

2121
if (data.hasOwnProperty('name')) {
2222
obj['name'] = ApiClient.convertToType(data['name'], 'String');
@@ -30,8 +30,8 @@ class IssuedTo {
3030
}
3131
}
3232

33-
IssuedTo.prototype['name'] = undefined;
33+
OrderIssuedTo.prototype['name'] = undefined;
3434

35-
IssuedTo.prototype['email'] = undefined;
35+
OrderIssuedTo.prototype['email'] = undefined;
3636

37-
export default IssuedTo;
37+
export default OrderIssuedTo;

src/model/PlaceOrderRequest.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import ApiClient from '../ApiClient';
9-
import V1OrdersIssuedTo from './V1OrdersIssuedTo';
9+
import OrderIssuedTo from './OrderIssuedTo';
1010

1111
class PlaceOrderRequest {
1212
constructor() {
@@ -19,10 +19,8 @@ class PlaceOrderRequest {
1919
if (data) {
2020
obj = obj || new PlaceOrderRequest();
2121

22-
if (data.hasOwnProperty('issuedTo')) {
23-
obj['issued_to'] = V1OrdersIssuedTo.constructFromObject(
24-
data['issuedTo']
25-
);
22+
if (data.hasOwnProperty('issued_to')) {
23+
obj['issued_to'] = OrderIssuedTo.constructFromObject(data['issued_to']);
2624
}
2725
}
2826
return obj;

src/model/V1OrdersIssuedTo.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/integration/orders.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ describe('Orders Integration', function () {
2626
expect(data.price_cents_usd + data.patch_fee_cents_usd).to.eq(100);
2727
});
2828

29-
it('supports creating an order with issuedTo', async function () {
29+
it('supports creating an order with issued_to', async function () {
3030
const issuedTo = { email: 'issuee@companyc.com', name: 'Bob Dylan' };
3131
const { data } = await patch.orders.createOrder({
3232
total_price_cents_usd: 100,
33-
issuedTo: issuedTo
33+
issued_to: issuedTo
3434
});
3535

3636
expect(data.price_cents_usd + data.patch_fee_cents_usd).to.eq(100);
@@ -53,7 +53,7 @@ describe('Orders Integration', function () {
5353
expect(placeOrderResponse.data.mass_g).to.equal(100);
5454
});
5555

56-
it('supports placing orders in a `draft` state with issuedTo', async function () {
56+
it('supports placing orders in a `draft` state with issued_to', async function () {
5757
const estimateResponse = await patch.estimates.createMassEstimate({
5858
mass_g: 100,
5959
create_order: true
@@ -64,7 +64,7 @@ describe('Orders Integration', function () {
6464
const issuedTo = { email: 'issuee@companyc.com', name: 'Bob Dylan' };
6565

6666
const placeOrderResponse = await patch.orders.placeOrder(orderId, {
67-
issuedTo: issuedTo
67+
issued_to: issuedTo
6868
});
6969
expect(placeOrderResponse.data.created_at).to.be.an.instanceOf(Date);
7070
expect(placeOrderResponse.data.production).to.equal(false);

0 commit comments

Comments
 (0)