diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d9886a..3bf57e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,34 @@ 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). +## [2.4.0] - 2025-05-16 + +### Removed + +- Removes `createHotelEstimate` method + +## [2.3.1] - 2025-04-28 + +### Removed + +- Removes `createEcommerceEstimateRequest` + +## [2.3.0] - 2025-01-10 + +### Breaking + +- Remove retired estimates API endpoints: + + - `createEthereumEstimateRequest` + - `createShippingEstimateRequest` + - `createVehicleEstimateRequest` + +## [1.19.0] - 2022-04-11 + +### Added + +- Adds `patch.estimates.createHotelEstimate()` method + ## [2.2.0] - 2024-05-06 ### Breaking diff --git a/README.md b/README.md index efc52f6..3b874e6 100644 --- a/README.md +++ b/README.md @@ -147,22 +147,6 @@ patch.estimates.createVehicleEstimate({ year: 1995 }); -// Create a hotel estimate -const country_code = 'US'; // ISO3166 alpha-2 country code -const city = 'New York'; // [Optional] -const region = 'New York'; // [Optional] -const star_rating = 4; // [Optional] Star rating of the hotel from 2 to 5 -const number_of_nights = 2; // [Optional] Default value is 1 -const number_of_rooms = 2; // [Optional] Default value is 1 -patch.estimates.createHotelEstimate({ - country_code, - city, - region, - star_rating, - number_of_nights, - number_of_rooms -}); - // Retrieve an estimate const estimateId = 'est_test_1234'; patch.estimates.retrieveEstimate(estimate_id); diff --git a/package-lock.json b/package-lock.json index a72030d..3065014 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@patch-technology/patch", - "version": "2.3.1", + "version": "2.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@patch-technology/patch", - "version": "2.3.1", + "version": "2.4.0", "license": "MIT", "dependencies": { "query-string": "^7.0.1", @@ -2150,6 +2150,25 @@ "dev": true, "optional": true }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@paralleldrive/cuid2": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz", + "integrity": "sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA==", + "dependencies": { + "@noble/hashes": "^1.1.5" + } + }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -2951,14 +2970,17 @@ } }, "node_modules/formidable": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", - "integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", + "integrity": "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==", "dependencies": { + "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", - "hexoid": "^1.0.0", "once": "^1.4.0" }, + "engines": { + "node": ">=14.0.0" + }, "funding": { "url": "https://ko-fi.com/tunnckoCore/commissions" } @@ -3142,14 +3164,6 @@ "he": "bin/he" } }, - "node_modules/hexoid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", - "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", - "engines": { - "node": ">=8" - } - }, "node_modules/human-signals": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", @@ -6701,6 +6715,19 @@ "dev": true, "optional": true }, + "@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==" + }, + "@paralleldrive/cuid2": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz", + "integrity": "sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA==", + "requires": { + "@noble/hashes": "^1.1.5" + } + }, "@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -7303,12 +7330,12 @@ } }, "formidable": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", - "integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", + "integrity": "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==", "requires": { + "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", - "hexoid": "^1.0.0", "once": "^1.4.0" } }, @@ -7436,11 +7463,6 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "hexoid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", - "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==" - }, "human-signals": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", diff --git a/package.json b/package.json index 45dd1da..15650c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "2.3.1", + "version": "2.4.0", "description": "Node.js wrapper for the Patch API", "license": "MIT", "repository": { diff --git a/src/ApiClient.js b/src/ApiClient.js index c2df667..58fdb4e 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -16,7 +16,7 @@ class ApiClient { }; this.defaultHeaders = { - 'User-Agent': 'patch-node/2.3.1', + 'User-Agent': 'patch-node/2.4.0', 'Patch-Version': 2 }; diff --git a/src/api/EstimatesApi.js b/src/api/EstimatesApi.js index 641a1f3..87fe658 100644 --- a/src/api/EstimatesApi.js +++ b/src/api/EstimatesApi.js @@ -9,7 +9,6 @@ import ApiClient from '../ApiClient'; import CreateAirShippingEstimateRequest from '../model/CreateAirShippingEstimateRequest'; import CreateBitcoinEstimateRequest from '../model/CreateBitcoinEstimateRequest'; import CreateFlightEstimateRequest from '../model/CreateFlightEstimateRequest'; -import CreateHotelEstimateRequest from '../model/CreateHotelEstimateRequest'; import CreateMassEstimateRequest from '../model/CreateMassEstimateRequest'; import CreateRailShippingEstimateRequest from '../model/CreateRailShippingEstimateRequest'; import CreateRoadShippingEstimateRequest from '../model/CreateRoadShippingEstimateRequest'; @@ -188,60 +187,6 @@ export default class EstimatesApi { ); } - createHotelEstimateWithHttpInfo(createHotelEstimateRequest, opts) { - opts = opts || {}; - - const _createHotelEstimateRequest = - CreateHotelEstimateRequest.constructFromObject( - createHotelEstimateRequest, - new CreateHotelEstimateRequest() - ); - - // verify the required parameter 'createHotelEstimateRequest' is set - if ( - _createHotelEstimateRequest === undefined || - _createHotelEstimateRequest === null - ) { - throw new Error( - "Missing the required parameter 'createHotelEstimateRequest' when calling createHotelEstimate" - ); - } - - let postBody = _createHotelEstimateRequest; - let pathParams = {}; - let queryParams = {}; - let headerParams = { - 'Patch-Version': opts['patchVersion'] - }; - let formParams = {}; - - let authNames = ['bearer_auth']; - let contentTypes = ['application/json']; - let accepts = ['application/json']; - let returnType = EstimateResponse; - - return this.apiClient.callApi( - '/v1/estimates/hotel', - 'POST', - pathParams, - queryParams, - headerParams, - formParams, - postBody, - authNames, - contentTypes, - accepts, - returnType - ); - } - - createHotelEstimate(createHotelEstimateRequest, opts) { - return this.createHotelEstimateWithHttpInfo( - createHotelEstimateRequest, - opts - ); - } - createMassEstimateWithHttpInfo(createMassEstimateRequest, opts) { opts = opts || {}; diff --git a/src/model/CreateHotelEstimateRequest.js b/src/model/CreateHotelEstimateRequest.js deleted file mode 100644 index bf7764a..0000000 --- a/src/model/CreateHotelEstimateRequest.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Patch API V2 - * The core API used to integrate with Patch's service - * - * Contact: engineering@usepatch.com - */ - -import ApiClient from '../ApiClient'; - -class CreateHotelEstimateRequest { - constructor(countryCode) { - CreateHotelEstimateRequest.initialize(this, countryCode); - } - - static initialize(obj, countryCode) { - obj['country_code'] = countryCode; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new CreateHotelEstimateRequest(); - - if (data.hasOwnProperty('country_code')) { - obj['country_code'] = ApiClient.convertToType( - data['country_code'], - 'String' - ); - } - - if (data.hasOwnProperty('city')) { - obj['city'] = ApiClient.convertToType(data['city'], 'String'); - } - - if (data.hasOwnProperty('region')) { - obj['region'] = ApiClient.convertToType(data['region'], 'String'); - } - - if (data.hasOwnProperty('star_rating')) { - obj['star_rating'] = ApiClient.convertToType( - data['star_rating'], - 'Number' - ); - } - - if (data.hasOwnProperty('number_of_nights')) { - obj['number_of_nights'] = ApiClient.convertToType( - data['number_of_nights'], - 'Number' - ); - } - - if (data.hasOwnProperty('number_of_rooms')) { - obj['number_of_rooms'] = ApiClient.convertToType( - data['number_of_rooms'], - 'Number' - ); - } - - if (data.hasOwnProperty('project_id')) { - obj['project_id'] = ApiClient.convertToType( - data['project_id'], - 'String' - ); - } - - if (data.hasOwnProperty('create_order')) { - obj['create_order'] = ApiClient.convertToType( - data['create_order'], - 'Boolean' - ); - } - } - return obj; - } -} - -CreateHotelEstimateRequest.prototype['country_code'] = undefined; - -CreateHotelEstimateRequest.prototype['city'] = undefined; - -CreateHotelEstimateRequest.prototype['region'] = undefined; - -CreateHotelEstimateRequest.prototype['star_rating'] = undefined; - -CreateHotelEstimateRequest.prototype['number_of_nights'] = undefined; - -CreateHotelEstimateRequest.prototype['number_of_rooms'] = undefined; - -CreateHotelEstimateRequest.prototype['project_id'] = undefined; - -CreateHotelEstimateRequest.prototype['create_order'] = false; - -export default CreateHotelEstimateRequest; diff --git a/test/integration/estimates.test.js b/test/integration/estimates.test.js index bff5d14..cb3c2e7 100644 --- a/test/integration/estimates.test.js +++ b/test/integration/estimates.test.js @@ -75,22 +75,6 @@ describe('Estimates Integration', function () { expect(estimate1.mass_g).to.be.below(estimate2.mass_g); }); - it('supports creating hotel estimates', async function () { - const createEstimateResponse = await patch.estimates.createHotelEstimate({ - country_code: 'US', - city: 'New York', - region: 'New York', - star_rating: 5, - number_of_nights: 2, - number_of_rooms: 2 - }); - const estimate = createEstimateResponse.data; - - expect(estimate.type).to.be.eq('hotel'); - expect(estimate.mass_g).to.be.above(150_000); - expect(estimate.production).to.be.eq(false); - }); - it('supports creating air shipping estimates from airports', async function () { const createEstimateResponse = await patch.estimates.createAirShippingEstimate({ diff --git a/yarn.lock b/yarn.lock index 9f31f53..66e1612 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1170,6 +1170,18 @@ resolved "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz" integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== +"@noble/hashes@^1.1.5": + version "1.8.0" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz" + integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== + +"@paralleldrive/cuid2@^2.2.2": + version "2.2.2" + resolved "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz" + integrity sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA== + dependencies: + "@noble/hashes" "^1.1.5" + "@sinonjs/commons@^2.0.0": version "2.0.0" resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz" @@ -1738,12 +1750,12 @@ form-data@^4.0.0: mime-types "^2.1.12" formidable@^3.5.1: - version "3.5.1" - resolved "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz" - integrity sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og== + version "3.5.4" + resolved "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz" + integrity sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug== dependencies: + "@paralleldrive/cuid2" "^2.2.2" dezalgo "^1.0.4" - hexoid "^1.0.0" once "^1.4.0" fs-readdir-recursive@^1.1.0: @@ -1866,11 +1878,6 @@ he@^1.2.0: resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hexoid@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz" - integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g== - human-signals@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz"