diff --git a/.github/workflows/health_check.yml b/.github/workflows/health_check.yml index 21cf3e7..1c0060f 100644 --- a/.github/workflows/health_check.yml +++ b/.github/workflows/health_check.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ['10','12','14','16'] + node: ['10', '12', '14', '16'] max-parallel: 1 name: Node ${{ matrix.node }} Test steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6f05263..d3eeb43 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: name: Create GitHub deployment id: deployment with: - token: "${{ github.token }}" + token: '${{ github.token }}' target_url: ${{ env.TARGET_URL }} environment: production @@ -45,16 +45,16 @@ jobs: if: success() uses: chrnorm/deployment-status@releases/v1 with: - token: "${{ github.token }}" + token: '${{ github.token }}' target_url: ${{ env.TARGET_URL }} - state: "success" + state: 'success' deployment_id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status (failure) if: failure() uses: chrnorm/deployment-status@releases/v1 with: - token: "${{ github.token }}" + token: '${{ github.token }}' target_url: ${{ env.TARGET_URL }} - state: "failure" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} \ No newline at end of file + state: 'failure' + deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/CHANGELOG.md b/CHANGELOG.md index da94fad..8616585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.11.0] - 2021-09-07 + +### Added + +- Adds support for airports, aircracts, cabin class and passenger count in flight estimates + ## [1.10.0] - 2021-08-27 ### Added diff --git a/package-lock.json b/package-lock.json index 89c08ba..70030db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@patch-technology/patch", - "version": "1.10.2", + "version": "1.11.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@patch-technology/patch", - "version": "1.10.2", + "version": "1.11.0", "license": "MIT", "dependencies": { "query-string": "^7.0.1", diff --git a/package.json b/package.json index 7425edb..c83692f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.10.2", + "version": "1.11.0", "description": "Node.js wrapper for the Patch API", "license": "MIT", "repository": { diff --git a/src/ApiClient.js b/src/ApiClient.js index ae45994..bf7ae12 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -16,7 +16,7 @@ class ApiClient { }; this.defaultHeaders = { - 'User-Agent': 'patch-node/1.10.2' + 'User-Agent': 'patch-node/1.11.0' }; /** diff --git a/src/model/CreateFlightEstimateRequest.js b/src/model/CreateFlightEstimateRequest.js index af10332..a2f3701 100644 --- a/src/model/CreateFlightEstimateRequest.js +++ b/src/model/CreateFlightEstimateRequest.js @@ -8,13 +8,11 @@ import ApiClient from '../ApiClient'; class CreateFlightEstimateRequest { - constructor(distanceM) { - CreateFlightEstimateRequest.initialize(this, distanceM); + constructor() { + CreateFlightEstimateRequest.initialize(this); } - static initialize(obj, distanceM) { - obj['distance_m'] = distanceM; - } + static initialize(obj) {} static constructFromObject(data, obj) { if (data) { @@ -27,6 +25,41 @@ class CreateFlightEstimateRequest { ); } + if (data.hasOwnProperty('origin_airport')) { + obj['origin_airport'] = ApiClient.convertToType( + data['origin_airport'], + 'String' + ); + } + + if (data.hasOwnProperty('destination_airport')) { + obj['destination_airport'] = ApiClient.convertToType( + data['destination_airport'], + 'String' + ); + } + + if (data.hasOwnProperty('aircraft_code')) { + obj['aircraft_code'] = ApiClient.convertToType( + data['aircraft_code'], + 'String' + ); + } + + if (data.hasOwnProperty('cabin_class')) { + obj['cabin_class'] = ApiClient.convertToType( + data['cabin_class'], + 'String' + ); + } + + if (data.hasOwnProperty('passenger_count')) { + obj['passenger_count'] = ApiClient.convertToType( + data['passenger_count'], + 'Number' + ); + } + if (data.hasOwnProperty('project_id')) { obj['project_id'] = ApiClient.convertToType( data['project_id'], @@ -47,6 +80,16 @@ class CreateFlightEstimateRequest { CreateFlightEstimateRequest.prototype['distance_m'] = undefined; +CreateFlightEstimateRequest.prototype['origin_airport'] = undefined; + +CreateFlightEstimateRequest.prototype['destination_airport'] = undefined; + +CreateFlightEstimateRequest.prototype['aircraft_code'] = undefined; + +CreateFlightEstimateRequest.prototype['cabin_class'] = undefined; + +CreateFlightEstimateRequest.prototype['passenger_count'] = undefined; + CreateFlightEstimateRequest.prototype['project_id'] = undefined; CreateFlightEstimateRequest.prototype['create_order'] = undefined; diff --git a/test/integration/estimates.test.js b/test/integration/estimates.test.js index c2e4e57..ed64b6f 100644 --- a/test/integration/estimates.test.js +++ b/test/integration/estimates.test.js @@ -21,10 +21,9 @@ describe('Estimates Integration', function () { expect(retrieveEstimatesResponse.data.length).to.be.above(0); }); - it('supports creating flight estimates with an order', async function () { + it('supports creating flight estimates with distance', async function () { const createEstimateResponse = await patch.estimates.createFlightEstimate({ - distance_m: 1000, - create_order: true + distance_m: 1000 }); const estimate = createEstimateResponse.data; @@ -34,6 +33,19 @@ describe('Estimates Integration', function () { expect(estimate.order.state).to.be.eq('draft'); }); + it('supports creating flight estimates with airports', async function () { + const { data: estimate1 } = await patch.estimates.createFlightEstimate({ + origin_airport: 'SFO', + destination_airport: 'LAX' + }); + const { data: estimate2 } = await patch.estimates.createFlightEstimate({ + origin_airport: 'SFO', + destination_airport: 'JFK' + }); + + expect(estimate2.mass_g).to.be.greaterThan(estimate1.mass_g); + }); + it('supports creating shipping estimates without an order', async function () { const createEstimateResponse = await patch.estimates.createShippingEstimate( {