Skip to content

Commit a0c30e9

Browse files
committed
Changelog; Readme
1 parent 8bd3496 commit a0c30e9

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Adds Sustainable Development Goals (SDGs) field to projects
13+
- Adds filtering to Projects by country, type
1314

1415
### Changed
1516

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ Patch::Estimate.retrieve_estimates(page: page)
144144
### Projects
145145
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.
146146

147+
When fetching Projects, you can add filters to the query to narrow the result. Currently supported filters are:
148+
149+
- `country`
150+
- `type`
151+
147152
[API Reference](https://docs.usepatch.com/#/?id=projects)
148153

149154
#### Examples
@@ -155,6 +160,14 @@ Patch::Project.retrieve_project(project_id)
155160
# Retrieve a list of projects
156161
page = 1 # Pass in which page of projects you'd like
157162
Patch::Project.retrieve_projects(page: page)
163+
164+
# Retrieve a all projects from the United States
165+
country = 'US' # Pass in the country code of the country you'd like to get Projects from
166+
Patch::Project.retrieve_projects(country: country)
167+
168+
# Retrieve a all biomass projects
169+
type = 'biomass' # Pass in the type of Projects you'd like to get
170+
Patch::Project.retrieve_projects(type: type)
158171
```
159172

160173
### Preferences

lib/patch_ruby/api/projects_api.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def retrieve_project_with_http_info(id, opts = {})
9191
# @param [Hash] opts the optional parameters
9292
# @option opts [Integer] :page
9393
# @option opts [String] :country
94-
# @option opts [Integer] :type
94+
# @option opts [String] :type
9595
# @return [ProjectListResponse]
9696
def retrieve_projects(opts = {})
9797
data, _status_code, _headers = retrieve_projects_with_http_info(opts)
@@ -103,7 +103,7 @@ def retrieve_projects(opts = {})
103103
# @param [Hash] opts the optional parameters
104104
# @option opts [Integer] :page
105105
# @option opts [String] :country
106-
# @option opts [Integer] :type
106+
# @option opts [String] :type
107107
# @return [Array<(ProjectListResponse, Integer, Hash)>] ProjectListResponse data, response status code and response headers
108108
def retrieve_projects_with_http_info(opts = {})
109109
if @api_client.config.debugging

spec/integration/projects_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
expect(project.country).to eq country
3030
end
3131

32-
type = 'biomass'
32+
type = 'dac'
3333
projects = Patch::Project.retrieve_projects(type: type)
3434
projects.data.map do |project|
3535
expect(project.type).to eq type

0 commit comments

Comments
 (0)