Skip to content

Commit 1d7dd06

Browse files
authored
Merge pull request #26 from patch-technology/patch.io
Update endpoint to patch.io
2 parents acc2e37 + fa3a005 commit 1d7dd06

File tree

6 files changed

+41
-15
lines changed

6 files changed

+41
-15
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.5.0] - 2021-03-01
9+
10+
### Changed
11+
12+
- Changed base URL from https://api.usepatch.com to https://api.patch.io
13+
814
## [1.4.0] - 2021-02-15
915

1016
### Added
@@ -20,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2026

2127
### Added
2228

23-
- Adds support for creating carbon emission estimates for flights, shipping, and vehicles. See the [docs](https://docs.usepatch.com/#/?id=estimates) for more information.
29+
- Adds support for creating carbon emission estimates for flights, shipping, and vehicles. See the [docs](https://docs.patch.io/#/?id=estimates) for more information.
2430

2531
## [1.2.5] - 2020-01-08
2632

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
11
# Patch Ruby SDK
2+
23
![Test](https://github.com/patch-technology/patch-ruby/workflows/Test/badge.svg)
34
[![Gem Version](https://badge.fury.io/rb/patch_ruby.svg)](https://badge.fury.io/rb/patch_ruby)
45
[![Discord](https://img.shields.io/discord/733029448558837792)](https://discord.gg/AU8543D)
56

6-
The official Ruby gem for the [Patch API](https://www.usepatch.com)
7+
The official Ruby gem for the [Patch API](https://www.patch.io)
78

89
## Documentation
9-
For a complete API reference, check out [Patch's API Reference.](https://docs.usepatch.com/)
10+
11+
For a complete API reference, check out [Patch's API Reference.](https://docs.patch.io/)
1012

1113
## Installation
1214

1315
Add the gem to your Gemfile:
16+
1417
```ruby
1518
gem 'patch_ruby'
1619
```
1720

1821
Then run:
22+
1923
```shell
2024
bundle
2125
```
2226

2327
Or install it directly with
28+
2429
```shell
2530
gem install patch_ruby
2631
```
2732

2833
### Requirements
34+
2935
- Ruby 1.9+
3036

3137
## Usage
3238

3339
### Configuration
3440

3541
After installing the gem, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard:
42+
3643
```ruby
3744
require 'patch_ruby'
3845

@@ -43,6 +50,7 @@ end
4350
```
4451

4552
### Orders
53+
4654
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate.
4755

4856
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass.
@@ -51,9 +59,10 @@ If you do not know how much to purchase, use an estimate.
5159
You can also create an order with a maximum desired price, and we'll allocate enough mass to
5260
fulfill the order for you.
5361

54-
[API Reference](https://docs.usepatch.com/#/?id=orders)
62+
[API Reference](https://docs.patch.io/#/?id=orders)
5563

5664
#### Examples
65+
5766
```ruby
5867
# Create an order - you can create an order
5968
# providing either mass_g or total_price_cents_usd, but not both
@@ -92,11 +101,13 @@ Patch::Order.retrieve_orders(page: page)
92101
```
93102

94103
### Estimates
104+
95105
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.
96106

97-
[API Reference](https://docs.usepatch.com/#/?id=estimates)
107+
[API Reference](https://docs.patch.io/#/?id=estimates)
98108

99109
#### Examples
110+
100111
```ruby
101112
# Create a mass estimate
102113
mass = 1_000_000 # Pass in the mass in grams (i.e. 1 metric tonne)
@@ -142,6 +153,7 @@ Patch::Estimate.retrieve_estimates(page: page)
142153
```
143154

144155
### Projects
156+
145157
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.
146158

147159
When fetching Projects, you can add filters to the query to narrow the result. Currently supported filters are:
@@ -150,9 +162,10 @@ When fetching Projects, you can add filters to the query to narrow the result. C
150162
- `type`
151163
- `minimum_available_mass`
152164

153-
[API Reference](https://docs.usepatch.com/#/?id=projects)
165+
[API Reference](https://docs.patch.io/#/?id=projects)
154166

155167
#### Examples
168+
156169
```ruby
157170
# Retrieve a project
158171
project_id = 'pro_test_1234' # Pass in the project's ID
@@ -176,11 +189,13 @@ Patch::Project.retrieve_projects(minimum_available_mass: minimum_available_mass)
176189
```
177190

178191
### Preferences
179-
Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.usepatch.com/projects).
180192

181-
[API Reference](https://docs.usepatch.com/#/?id=preferences)
193+
Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.patch.io/projects).
194+
195+
[API Reference](https://docs.patch.io/#/?id=preferences)
182196

183197
#### Examples
198+
184199
```ruby
185200
# Create a preference
186201
project_id = 'pro_test_1234' # Pass in the project_id for your preference
@@ -202,26 +217,31 @@ Patch::Preference.retrieve_preferences(page: page)
202217
## Development
203218

204219
To build the gem locally, run:
220+
205221
```
206222
$ gem build patch_ruby.gemspec
207223
```
208224

209225
This will create a .gem file. To install the local gem:
226+
210227
```
211228
$ gem install patch_ruby-1.x.x.gem
212229
```
213230

214231
Install dependencies:
232+
215233
```
216234
$ bundle install
217235
```
218236

219237
Set up required environment variables:
238+
220239
```
221240
$ export SANDBOX_API_KEY=<SANDBOX API KEY>
222241
```
223242

224243
Run tests:
244+
225245
```
226246
$ bundle exec rspec
227247
```

lib/patch_ruby/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Configuration
127127

128128
def initialize
129129
@scheme = 'https'
130-
@host = 'api.usepatch.com'
130+
@host = 'api.patch.io'
131131
@base_path = ''
132132
@api_key = {}
133133
@api_key_prefix = {}
@@ -212,7 +212,7 @@ def server_settings
212212
variables: {
213213
defaultHost: {
214214
description: "No description provided",
215-
default_value: "api.usepatch.com",
215+
default_value: "api.patch.io",
216216
}
217217
}
218218
}

lib/patch_ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
=end
1212

1313
module Patch
14-
VERSION = '1.4.0'
14+
VERSION = '1.5.0'
1515
end

patch_ruby.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.platform = Gem::Platform::RUBY
2222
s.authors = ["Patch Technology"]
2323
s.email = ["developers@usepatch.com"]
24-
s.homepage = "https://www.usepatch.com"
24+
s.homepage = "https://www.patch.io"
2525
s.summary = "Ruby wrapper for the Patch API"
2626
s.description = "Ruby wrapper for the Patch API"
2727
s.license = 'MIT'

spec/configuration_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
before(:each) do
1919
# uncomment below to setup host and base_path
2020
# require 'URI'
21-
# uri = URI.parse("https://api.usepatch.com")
21+
# uri = URI.parse("https://api.patch.io")
2222
# Patch.configure do |c|
2323
# c.host = uri.host
2424
# c.base_path = uri.path
@@ -28,14 +28,14 @@
2828
describe '#base_url' do
2929
it 'should have the default value' do
3030
# uncomment below to test default value of the base path
31-
# expect(config.base_url).to eq("https://api.usepatch.com")
31+
# expect(config.base_url).to eq("https://api.patch.io")
3232
end
3333

3434
it 'should remove trailing slashes' do
3535
[nil, '', '/', '//'].each do |base_path|
3636
config.base_path = base_path
3737
# uncomment below to test trailing slashes
38-
# expect(config.base_url).to eq("https://api.usepatch.com")
38+
# expect(config.base_url).to eq("https://api.patch.io")
3939
end
4040
end
4141
end

0 commit comments

Comments
 (0)