Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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.6.0] - 2025-11-07

- Removes create_mass_estimate and create_bitcoin_estimate method
- Retires all remaining estimates functionalities

## [2.5.0] - 2025-08-19

### Removed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ gemspec
group :development, :test do
gem 'rake', '~> 13.0.1'
gem 'pry-byebug'
gem 'rubocop', '~> 1.75.6'
gem 'rubocop', '~> 0.66.0'
end
43 changes: 18 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
patch_ruby (2.5.0)
patch_ruby (2.6.0)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand All @@ -16,34 +16,34 @@ GEM
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
date (3.5.0)
diff-lcs (1.4.4)
ethon (0.16.0)
ethon (0.15.0)
ffi (>= 1.15.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
ffi (1.17.2)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.12.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
jaro_winkler (1.5.6)
method_source (1.0.0)
minitest (5.18.0)
parallel (1.27.0)
parser (3.3.8.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prism (1.4.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.8.0)
byebug (~> 11.0)
pry (~> 0.10)
psych (5.2.6)
date
stringio
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.10.0)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
Expand All @@ -57,28 +57,21 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.75.6)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
rubocop (0.66.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 3.3.0.2)
parser (>= 2.5, != 2.5.1.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.44.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
unicode-display_width (>= 1.4.0, < 1.6)
ruby-progressbar (1.13.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
stringio (3.1.7)
typhoeus (1.5.0)
ethon (>= 0.9.0, < 0.16.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
unicode-display_width (1.5.0)

PLATFORMS
arm64-darwin-20
Expand All @@ -96,7 +89,7 @@ DEPENDENCIES
pry-byebug
rake (~> 13.0.1)
rspec (~> 3.6, >= 3.6.0)
rubocop (~> 1.75.6)
rubocop (~> 0.66.0)

BUNDLED WITH
2.3.9
52 changes: 0 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,58 +110,6 @@ page = 1 # Pass in which page of orders you'd like
Patch::Order.retrieve_orders(page: page)
```

### Estimates

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.

[API Reference](https://docs.patch.io/#/?id=estimates)

#### Examples

```ruby
# Create a mass estimate
mass = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
Patch::Estimate.create_mass_estimate(mass_g: mass)

# Create a vehicle estimate
distance_m = 1_000_000 # Pass in the shipping distance in meters
make = "Toyota" # Pass in the car make
model = "Corolla" # Pass in the car model
year = 2000 # Pass in the car year
Patch::Estimate.create_vehicle_estimate(
distance_m: distance_m,
make: make,
model: model,
year: year
)

# Create a Bitcoin estimate
transaction_value_btc_sats = 1000; # [Optional] Pass in the transaction value in satoshis
Patch::Estimate.create_bitcoin_estimate(transaction_value_btc_sats: transaction_value_btc_sats)

# Create an ecommerce estimate
distance_m = 1_000_000 # Pass in the shipping distance in meters
package_mass_g = 10_000 # Pass in the weight of the package shipped in grams
transportation_method = "air" # Pass in the transportation method (air, rail, road, sea)
Patch::Estimate.create_ecommerce_estimate(
distance_m: distance_m,
package_mass_g: package_mass_g,
transportation_method: transportation_method
)

## You can also specify a project-id field (optional) to be used instead of the preferred one
project_id = 'pro_test_1234' # Pass in the project's ID
Patch::Estimate.create_mass_estimate(mass_g: mass, project_id: project_id)

# Retrieve an estimate
estimate_id = 'est_test_1234'
Patch::Estimate.retrieve_estimate(estimate_id)

# Retrieve a list of estimates
page = 1 # Pass in which page of estimates you'd like
Patch::Estimate.retrieve_estimates(page: page)
```

### Projects

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.
Expand Down
10 changes: 0 additions & 10 deletions lib/patch_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,13 @@
require 'patch_ruby/configuration'

# Models
require 'patch_ruby/models/create_air_shipping_estimate_request'
require 'patch_ruby/models/create_bitcoin_estimate_request'
require 'patch_ruby/models/create_mass_estimate_request'
require 'patch_ruby/models/create_order_line_item_request'
require 'patch_ruby/models/create_order_request'
require 'patch_ruby/models/create_rail_shipping_estimate_request'
require 'patch_ruby/models/create_road_shipping_estimate_request'
require 'patch_ruby/models/create_sea_shipping_estimate_request'
require 'patch_ruby/models/create_success_response'
require 'patch_ruby/models/delete_order_line_item_response'
require 'patch_ruby/models/delete_order_response'
require 'patch_ruby/models/disclaimer'
require 'patch_ruby/models/error_response'
require 'patch_ruby/models/estimate'
require 'patch_ruby/models/estimate_list_response'
require 'patch_ruby/models/estimate_response'
require 'patch_ruby/models/highlight'
require 'patch_ruby/models/inventory'
require 'patch_ruby/models/meta_index_object'
Expand All @@ -56,7 +47,6 @@
require 'patch_ruby/models/update_order_line_item_request'

# APIs
require 'patch_ruby/api/estimates_api'
require 'patch_ruby/api/order_line_items_api'
require 'patch_ruby/api/orders_api'
require 'patch_ruby/api/projects_api'
Expand Down
Loading
Loading