@@ -102,27 +102,33 @@ Estimates allow API users to get a quote for the cost of compensating a certain
102102
103103``` javascript
104104// Create a mass estimate
105- const mass = 1000000 ; // Pass in the mass in grams (i.e. 1 metric tonne)
106- patch .estimates .createMassEstimate ({ mass_g: mass });
105+ const mass_g = 1000000 ; // Pass in the mass in grams (i.e. 1 metric tonne)
106+ patch .estimates .createMassEstimate ({ mass_g });
107107
108108// Create a flight estimate
109109const distance_m = 9000000 ; // Pass in the distance traveled in meters
110- patch .estimates .createFlightEstimate ({ distance_m: distance_m });
110+ patch .estimates .createFlightEstimate ({ distance_m });
111111
112112// Create a shipping estimate
113113const distance_m = 9000000 ;
114114// Pass in the shipping distance in meters, the transportation method, and the package mass
115115patch .estimates .createShippingEstimate ({
116- distance_m: distance_m ,
116+ distance_m,
117117 transportation_method: ' air' ,
118118 package_mass_g: 1000
119119});
120120
121+ // Create a bitcoin estimate
122+ const transaction_value_btc_sats = 1000 ; // [Optional] Pass in the transaction value in satoshis
123+ patch .estimates .createBitcoinEstimate ({
124+ transaction_value_btc_sats
125+ });
126+
121127// Create a vehicle estimate
122128const distance_m = 9000000 ;
123129// Pass in the shipping distance in meters and the model/make/year of the vehicle
124130patch .estimates .createVehicleEstimate ({
125- distance_m: distance_m ,
131+ distance_m,
126132 make: ' Toyota' ,
127133 model: ' Corolla' ,
128134 year: 1995
@@ -184,7 +190,7 @@ Preferences are how you route your orders in Patch. If you don't have a preferen
184190``` javascript
185191// Create a preference
186192const projectId = ' pro_test_1234' ; // Pass in the project_id for your preference
187- patch .preferences .createPreference (( project_id: projectId) );
193+ patch .preferences .createPreference ({ project_id: projectId } );
188194
189195// Retrieve a preference
190196const preferenceId = ' pre_test_1234' ; // Pass in the preferences's id
@@ -234,9 +240,13 @@ $ npm link @patch-technology/patch
234240This will create a ` node_modules ` directory in your test repository which will symlink to your locally built package. To test out the package, open a node REPL and import the package and run some queries.
235241
236242``` sh
237- $ node
238- > const Patch = require(' @patch-technology/patch' )
239- > Patch.default(process.env.SANDBOX_API_KEY).projects.retrieveProjects ().then(( response) => console.log(response))
243+ SANDBOX_API_KEY=xxx node
244+ ```
245+
246+ ``` node
247+ const Patch = require (' @patch-technology/patch' );
248+ const patch = Patch .default (process .env .SANDBOX_API_KEY );
249+ patch .projects .retrieveProjects ().then ((response ) => console .log (response));
240250```
241251
242252### Run the specs
0 commit comments