Skip to content

Commit b5f743e

Browse files
committed
Tweaks
1 parent 9ca057f commit b5f743e

File tree

9 files changed

+0
-937
lines changed

9 files changed

+0
-937
lines changed

README.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -110,58 +110,6 @@ page = 1 # Pass in which page of orders you'd like
110110
Patch::Order.retrieve_orders(page: page)
111111
```
112112

113-
### Estimates
114-
115-
Estimates allow API users to get a quote for the cost of compensating a certain amount of CO2. When creating an estimate, an order in the `draft` state will also be created, reserving the allocation of a project for 5 minutes. If you don't place your draft order within those 5 minutes, the order will automatically be cancelled.
116-
117-
[API Reference](https://docs.patch.io/#/?id=estimates)
118-
119-
#### Examples
120-
121-
```ruby
122-
# Create a mass estimate
123-
mass = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
124-
Patch::Estimate.create_mass_estimate(mass_g: mass)
125-
126-
# Create a vehicle estimate
127-
distance_m = 1_000_000 # Pass in the shipping distance in meters
128-
make = "Toyota" # Pass in the car make
129-
model = "Corolla" # Pass in the car model
130-
year = 2000 # Pass in the car year
131-
Patch::Estimate.create_vehicle_estimate(
132-
distance_m: distance_m,
133-
make: make,
134-
model: model,
135-
year: year
136-
)
137-
138-
# Create a Bitcoin estimate
139-
transaction_value_btc_sats = 1000; # [Optional] Pass in the transaction value in satoshis
140-
Patch::Estimate.create_bitcoin_estimate(transaction_value_btc_sats: transaction_value_btc_sats)
141-
142-
# Create an ecommerce estimate
143-
distance_m = 1_000_000 # Pass in the shipping distance in meters
144-
package_mass_g = 10_000 # Pass in the weight of the package shipped in grams
145-
transportation_method = "air" # Pass in the transportation method (air, rail, road, sea)
146-
Patch::Estimate.create_ecommerce_estimate(
147-
distance_m: distance_m,
148-
package_mass_g: package_mass_g,
149-
transportation_method: transportation_method
150-
)
151-
152-
## You can also specify a project-id field (optional) to be used instead of the preferred one
153-
project_id = 'pro_test_1234' # Pass in the project's ID
154-
Patch::Estimate.create_mass_estimate(mass_g: mass, project_id: project_id)
155-
156-
# Retrieve an estimate
157-
estimate_id = 'est_test_1234'
158-
Patch::Estimate.retrieve_estimate(estimate_id)
159-
160-
# Retrieve a list of estimates
161-
page = 1 # Pass in which page of estimates you'd like
162-
Patch::Estimate.retrieve_estimates(page: page)
163-
```
164-
165113
### Projects
166114

167115
Projects are the ways Patch takes CO2 out of the air. They can represent reforestation, enhanced weathering, direct air carbon capture, etc. When you place an order via Patch, it is allocated to a project.

lib/patch_ruby/api/estimates_api.rb

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

spec/api/orders_api_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
# unit tests for create_order
4848
# Creates an order
49-
# Creates an order in the `placed` state. To create a `draft` order, create an estimate first.
5049
# @param create_order_request
5150
# @param [Hash] opts the optional parameters
5251
# @return [OrderResponse]

spec/factories/create_mass_estimate_requests.rb

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

spec/factories/estimate_list_responses.rb

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

spec/factories/estimate_responses.rb

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

spec/factories/estimates.rb

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

spec/integration/estimates_spec.rb

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

spec/integration/orders_spec.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,31 +99,6 @@
9999
expect(create_order_response.data.state).to eq("draft")
100100
end
101101

102-
it 'supports place and cancel for orders created via an estimate' do
103-
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
104-
order_to_place_id = create_estimate_to_place_response.data.order.id
105-
106-
place_order_response = Patch::Order.place_order(order_to_place_id)
107-
expect(place_order_response.data.state).to eq 'placed'
108-
109-
create_estimate_to_cancel_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
110-
order_to_cancel_id = create_estimate_to_cancel_response.data.order.id
111-
112-
cancel_order_response = Patch::Order.cancel_order(order_to_cancel_id)
113-
expect(cancel_order_response.data.state).to eq 'cancelled'
114-
end
115-
116-
it 'supports place order with issued_to' do
117-
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
118-
order_to_place_id = create_estimate_to_place_response.data.order.id
119-
120-
issued_to = { email: 'envimpact@companya.com', name: 'Company A' }
121-
place_order_response = Patch::Order.place_order(order_to_place_id, issued_to: issued_to)
122-
expect(place_order_response.data.state).to eq 'placed'
123-
expect(place_order_response.data.issued_to.email).to eq(issued_to[:email])
124-
expect(place_order_response.data.issued_to.name).to eq(issued_to[:name])
125-
end
126-
127102
it 'supports create with a vintage year' do
128103
create_order_response =
129104
Patch::Order.create_order(amount: 100, unit: "g", vintage_year: 2022)

0 commit comments

Comments
 (0)