patch_ruby 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +18 -25
  5. data/README.md +0 -52
  6. data/lib/patch_ruby/api_client.rb +1 -1
  7. data/lib/patch_ruby/version.rb +1 -1
  8. data/lib/patch_ruby.rb +0 -10
  9. data/spec/api/orders_api_spec.rb +0 -1
  10. data/spec/integration/orders_spec.rb +0 -25
  11. data/spec/integration/projects_spec.rb +1 -1
  12. metadata +15 -45
  13. data/lib/patch_ruby/api/estimates_api.rb +0 -612
  14. data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +0 -374
  15. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +0 -271
  16. data/lib/patch_ruby/models/create_mass_estimate_request.rb +0 -282
  17. data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +0 -404
  18. data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +0 -517
  19. data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +0 -461
  20. data/lib/patch_ruby/models/estimate.rb +0 -288
  21. data/lib/patch_ruby/models/estimate_list_response.rb +0 -273
  22. data/lib/patch_ruby/models/estimate_response.rb +0 -257
  23. data/spec/api/estimates_api_spec.rb +0 -70
  24. data/spec/factories/create_mass_estimate_requests.rb +0 -6
  25. data/spec/factories/estimate_list_responses.rb +0 -8
  26. data/spec/factories/estimate_responses.rb +0 -7
  27. data/spec/factories/estimates.rb +0 -8
  28. data/spec/integration/estimates_spec.rb +0 -218
  29. data/spec/models/create_mass_estimate_request_spec.rb +0 -46
  30. data/spec/models/estimate_list_response_spec.rb +0 -64
  31. data/spec/models/estimate_response_spec.rb +0 -58
  32. data/spec/models/estimate_spec.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f45f73f5a0d485524694df0e81f00c0df48628442ef1edb9153d47047fcc8ad
4
- data.tar.gz: 17700875029da791ce206a83f0a85736173c6d22050567f2e124b79d0250e2f4
3
+ metadata.gz: 26e4d4de12a68e3281d8facf58424995476aa072a33eb363f86d72fec52136f4
4
+ data.tar.gz: 98ec46e4a5c79a2183254ef85b7d2beee5d5c8f50e68b2e011553f7afbba503e
5
5
  SHA512:
6
- metadata.gz: e0c9c11a47c3472d0d62f379a60c1ff9128bbad335965b388c2e6e7e27cfd1602424b803e448a68f28196e2164dd6793b64dc5e37da9460ad37ddb4db2d28c4e
7
- data.tar.gz: a8f8649b420733b967ebbf992043e1082b3a48c436c78f777de4f72c8999943ee2f58577ecbba5e4762970c542d86321ca4cabd7d14757791109c2a92f99c7cc
6
+ metadata.gz: 8b64260f66d7dce2597beb4e56bc83848dc5493b68fcbbfd3f5feaae0bd9c37a8961813fd9557456816ccec7014a80cec3f06751fae811c8ad81c38d39e6bfdf
7
+ data.tar.gz: d89f8334f65af97d40544e5ab553957e3a4c9d97aefa16a3b15ae04691d71303ee833f71be661534fc49948c624ba96ec5a75dd8f2efd27ba0e64e769b444306
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.6.0] - 2025-11-07
9
+
10
+ - Removes create_mass_estimate and create_bitcoin_estimate method
11
+ - Retires all remaining estimates functionalities
12
+
8
13
  ## [2.5.0] - 2025-08-19
9
14
 
10
15
  ### Removed
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ gemspec
5
5
  group :development, :test do
6
6
  gem 'rake', '~> 13.0.1'
7
7
  gem 'pry-byebug'
8
- gem 'rubocop', '~> 1.75.6'
8
+ gem 'rubocop', '~> 0.66.0'
9
9
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (2.5.0)
4
+ patch_ruby (2.6.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -16,34 +16,34 @@ GEM
16
16
  byebug (11.1.3)
17
17
  coderay (1.1.3)
18
18
  concurrent-ruby (1.2.2)
19
+ date (3.5.0)
19
20
  diff-lcs (1.4.4)
20
- ethon (0.16.0)
21
+ ethon (0.15.0)
21
22
  ffi (>= 1.15.0)
22
23
  factory_bot (6.2.0)
23
24
  activesupport (>= 5.0.0)
24
25
  ffi (1.17.2)
25
26
  i18n (1.12.0)
26
27
  concurrent-ruby (~> 1.0)
27
- json (2.12.0)
28
- language_server-protocol (3.17.0.5)
29
- lint_roller (1.1.0)
28
+ jaro_winkler (1.5.6)
30
29
  method_source (1.0.0)
31
30
  minitest (5.18.0)
32
31
  parallel (1.27.0)
33
- parser (3.3.8.0)
32
+ parser (3.3.10.0)
34
33
  ast (~> 2.4.1)
35
34
  racc
36
- prism (1.4.0)
37
35
  pry (0.14.1)
38
36
  coderay (~> 1.1)
39
37
  method_source (~> 1.0)
40
38
  pry-byebug (3.8.0)
41
39
  byebug (~> 11.0)
42
40
  pry (~> 0.10)
41
+ psych (5.2.6)
42
+ date
43
+ stringio
43
44
  racc (1.8.1)
44
45
  rainbow (3.1.1)
45
46
  rake (13.0.6)
46
- regexp_parser (2.10.0)
47
47
  rspec (3.10.0)
48
48
  rspec-core (~> 3.10.0)
49
49
  rspec-expectations (~> 3.10.0)
@@ -57,28 +57,21 @@ GEM
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.10.0)
59
59
  rspec-support (3.10.2)
60
- rubocop (1.75.6)
61
- json (~> 2.3)
62
- language_server-protocol (~> 3.17.0.2)
63
- lint_roller (~> 1.1.0)
60
+ rubocop (0.66.0)
61
+ jaro_winkler (~> 1.5.1)
64
62
  parallel (~> 1.10)
65
- parser (>= 3.3.0.2)
63
+ parser (>= 2.5, != 2.5.1.1)
64
+ psych (>= 3.1.0)
66
65
  rainbow (>= 2.2.2, < 4.0)
67
- regexp_parser (>= 2.9.3, < 3.0)
68
- rubocop-ast (>= 1.44.0, < 2.0)
69
66
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 2.4.0, < 4.0)
71
- rubocop-ast (1.44.1)
72
- parser (>= 3.3.7.2)
73
- prism (~> 1.4)
67
+ unicode-display_width (>= 1.4.0, < 1.6)
74
68
  ruby-progressbar (1.13.0)
75
- typhoeus (1.4.1)
76
- ethon (>= 0.9.0)
69
+ stringio (3.1.7)
70
+ typhoeus (1.5.0)
71
+ ethon (>= 0.9.0, < 0.16.0)
77
72
  tzinfo (2.0.6)
78
73
  concurrent-ruby (~> 1.0)
79
- unicode-display_width (3.1.4)
80
- unicode-emoji (~> 4.0, >= 4.0.4)
81
- unicode-emoji (4.0.4)
74
+ unicode-display_width (1.5.0)
82
75
 
83
76
  PLATFORMS
84
77
  arm64-darwin-20
@@ -96,7 +89,7 @@ DEPENDENCIES
96
89
  pry-byebug
97
90
  rake (~> 13.0.1)
98
91
  rspec (~> 3.6, >= 3.6.0)
99
- rubocop (~> 1.75.6)
92
+ rubocop (~> 0.66.0)
100
93
 
101
94
  BUNDLED WITH
102
95
  2.3.9
data/README.md CHANGED
@@ -110,58 +110,6 @@ page = 1 # Pass in which page of orders you'd like
110
110
  Patch::Order.retrieve_orders(page: page)
111
111
  ```
112
112
 
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
-
165
113
  ### Projects
166
114
 
167
115
  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.
@@ -31,7 +31,7 @@ module Patch
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "patch-ruby/2.5.0"
34
+ @user_agent = "patch-ruby/2.6.0"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '2.5.0'
14
+ VERSION = '2.6.0'
15
15
  end
data/lib/patch_ruby.rb CHANGED
@@ -17,22 +17,13 @@ require 'patch_ruby/version'
17
17
  require 'patch_ruby/configuration'
18
18
 
19
19
  # Models
20
- require 'patch_ruby/models/create_air_shipping_estimate_request'
21
- require 'patch_ruby/models/create_bitcoin_estimate_request'
22
- require 'patch_ruby/models/create_mass_estimate_request'
23
20
  require 'patch_ruby/models/create_order_line_item_request'
24
21
  require 'patch_ruby/models/create_order_request'
25
- require 'patch_ruby/models/create_rail_shipping_estimate_request'
26
- require 'patch_ruby/models/create_road_shipping_estimate_request'
27
- require 'patch_ruby/models/create_sea_shipping_estimate_request'
28
22
  require 'patch_ruby/models/create_success_response'
29
23
  require 'patch_ruby/models/delete_order_line_item_response'
30
24
  require 'patch_ruby/models/delete_order_response'
31
25
  require 'patch_ruby/models/disclaimer'
32
26
  require 'patch_ruby/models/error_response'
33
- require 'patch_ruby/models/estimate'
34
- require 'patch_ruby/models/estimate_list_response'
35
- require 'patch_ruby/models/estimate_response'
36
27
  require 'patch_ruby/models/highlight'
37
28
  require 'patch_ruby/models/inventory'
38
29
  require 'patch_ruby/models/meta_index_object'
@@ -56,7 +47,6 @@ require 'patch_ruby/models/technology_type_list_response'
56
47
  require 'patch_ruby/models/update_order_line_item_request'
57
48
 
58
49
  # APIs
59
- require 'patch_ruby/api/estimates_api'
60
50
  require 'patch_ruby/api/order_line_items_api'
61
51
  require 'patch_ruby/api/orders_api'
62
52
  require 'patch_ruby/api/projects_api'
@@ -46,7 +46,6 @@ describe 'OrdersApi' do
46
46
 
47
47
  # unit tests for create_order
48
48
  # Creates an order
49
- # Creates an order in the &#x60;placed&#x60; state. To create a &#x60;draft&#x60; order, create an estimate first.
50
49
  # @param create_order_request
51
50
  # @param [Hash] opts the optional parameters
52
51
  # @return [OrderResponse]
@@ -99,31 +99,6 @@ RSpec.describe 'Orders Integration' do
99
99
  expect(create_order_response.data.state).to eq("draft")
100
100
  end
101
101
 
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
-
127
102
  it 'supports create with a vintage year' do
128
103
  create_order_response =
129
104
  Patch::Order.create_order(amount: 100, unit: "g", vintage_year: 2022)
@@ -25,7 +25,7 @@ RSpec.describe 'Projects Integration' do
25
25
  expect(project.country).to eq country
26
26
  end
27
27
 
28
- type = 'dac'
28
+ type = 'biogas'
29
29
  projects = Patch::Project.retrieve_projects(type: type)
30
30
  projects.data.map do |project|
31
31
  expect(project.type).to eq type
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patch Technology
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-19 00:00:00.000000000 Z
11
+ date: 2025-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -93,7 +93,6 @@ files:
93
93
  - Rakefile
94
94
  - bin/rspec
95
95
  - lib/patch_ruby.rb
96
- - lib/patch_ruby/api/estimates_api.rb
97
96
  - lib/patch_ruby/api/order_line_items_api.rb
98
97
  - lib/patch_ruby/api/orders_api.rb
99
98
  - lib/patch_ruby/api/projects_api.rb
@@ -101,22 +100,13 @@ files:
101
100
  - lib/patch_ruby/api_client.rb
102
101
  - lib/patch_ruby/api_error.rb
103
102
  - lib/patch_ruby/configuration.rb
104
- - lib/patch_ruby/models/create_air_shipping_estimate_request.rb
105
- - lib/patch_ruby/models/create_bitcoin_estimate_request.rb
106
- - lib/patch_ruby/models/create_mass_estimate_request.rb
107
103
  - lib/patch_ruby/models/create_order_line_item_request.rb
108
104
  - lib/patch_ruby/models/create_order_request.rb
109
- - lib/patch_ruby/models/create_rail_shipping_estimate_request.rb
110
- - lib/patch_ruby/models/create_road_shipping_estimate_request.rb
111
- - lib/patch_ruby/models/create_sea_shipping_estimate_request.rb
112
105
  - lib/patch_ruby/models/create_success_response.rb
113
106
  - lib/patch_ruby/models/delete_order_line_item_response.rb
114
107
  - lib/patch_ruby/models/delete_order_response.rb
115
108
  - lib/patch_ruby/models/disclaimer.rb
116
109
  - lib/patch_ruby/models/error_response.rb
117
- - lib/patch_ruby/models/estimate.rb
118
- - lib/patch_ruby/models/estimate_list_response.rb
119
- - lib/patch_ruby/models/estimate_response.rb
120
110
  - lib/patch_ruby/models/highlight.rb
121
111
  - lib/patch_ruby/models/inventory.rb
122
112
  - lib/patch_ruby/models/meta_index_object.rb
@@ -140,7 +130,6 @@ files:
140
130
  - lib/patch_ruby/models/update_order_line_item_request.rb
141
131
  - lib/patch_ruby/version.rb
142
132
  - patch_ruby.gemspec
143
- - spec/api/estimates_api_spec.rb
144
133
  - spec/api/order_line_items_api_spec.rb
145
134
  - spec/api/orders_api_spec.rb
146
135
  - spec/api/projects_api_spec.rb
@@ -148,12 +137,8 @@ files:
148
137
  - spec/api_client_spec.rb
149
138
  - spec/configuration_spec.rb
150
139
  - spec/constants.rb
151
- - spec/factories/create_mass_estimate_requests.rb
152
140
  - spec/factories/create_order_requests.rb
153
141
  - spec/factories/error_responses.rb
154
- - spec/factories/estimate_list_responses.rb
155
- - spec/factories/estimate_responses.rb
156
- - spec/factories/estimates.rb
157
142
  - spec/factories/meta_index_objects.rb
158
143
  - spec/factories/order_list_responses.rb
159
144
  - spec/factories/order_responses.rb
@@ -164,16 +149,11 @@ files:
164
149
  - spec/factories/projects.rb
165
150
  - spec/factories/sdgs.rb
166
151
  - spec/factories/technology_type.rb
167
- - spec/integration/estimates_spec.rb
168
152
  - spec/integration/orders_spec.rb
169
153
  - spec/integration/projects/technology_types_spec.rb
170
154
  - spec/integration/projects_spec.rb
171
- - spec/models/create_mass_estimate_request_spec.rb
172
155
  - spec/models/create_order_request_spec.rb
173
156
  - spec/models/error_response_spec.rb
174
- - spec/models/estimate_list_response_spec.rb
175
- - spec/models/estimate_response_spec.rb
176
- - spec/models/estimate_spec.rb
177
157
  - spec/models/meta_index_object_spec.rb
178
158
  - spec/models/order_list_response_spec.rb
179
159
  - spec/models/order_response_spec.rb
@@ -208,46 +188,36 @@ signing_key:
208
188
  specification_version: 4
209
189
  summary: Ruby wrapper for the Patch API
210
190
  test_files:
211
- - spec/api/estimates_api_spec.rb
191
+ - spec/api/order_line_items_api_spec.rb
192
+ - spec/api/orders_api_spec.rb
212
193
  - spec/api/technology_types_api_spec.rb
213
194
  - spec/api/projects_api_spec.rb
214
- - spec/api/orders_api_spec.rb
215
- - spec/api/order_line_items_api_spec.rb
216
195
  - spec/api_client_spec.rb
217
196
  - spec/configuration_spec.rb
218
197
  - spec/constants.rb
219
- - spec/factories/project_list_responses.rb
220
- - spec/factories/order_responses.rb
221
- - spec/factories/parent_technology_type.rb
222
- - spec/factories/orders.rb
223
- - spec/factories/estimate_responses.rb
224
198
  - spec/factories/order_list_responses.rb
225
- - spec/factories/estimates.rb
226
- - spec/factories/create_mass_estimate_requests.rb
227
199
  - spec/factories/sdgs.rb
228
- - spec/factories/estimate_list_responses.rb
200
+ - spec/factories/meta_index_objects.rb
229
201
  - spec/factories/create_order_requests.rb
202
+ - spec/factories/project_list_responses.rb
203
+ - spec/factories/order_responses.rb
230
204
  - spec/factories/technology_type.rb
231
- - spec/factories/meta_index_objects.rb
205
+ - spec/factories/projects.rb
232
206
  - spec/factories/project_responses.rb
207
+ - spec/factories/parent_technology_type.rb
233
208
  - spec/factories/error_responses.rb
234
- - spec/factories/projects.rb
209
+ - spec/factories/orders.rb
210
+ - spec/integration/projects/technology_types_spec.rb
235
211
  - spec/integration/projects_spec.rb
236
212
  - spec/integration/orders_spec.rb
237
- - spec/integration/projects/technology_types_spec.rb
238
- - spec/integration/estimates_spec.rb
239
- - spec/models/order_spec.rb
240
- - spec/models/project_list_response_spec.rb
241
- - spec/models/estimate_list_response_spec.rb
242
- - spec/models/create_order_request_spec.rb
243
- - spec/models/estimate_response_spec.rb
244
213
  - spec/models/order_response_spec.rb
245
- - spec/models/project_response_spec.rb
246
- - spec/models/estimate_spec.rb
247
214
  - spec/models/error_response_spec.rb
248
- - spec/models/create_mass_estimate_request_spec.rb
215
+ - spec/models/project_response_spec.rb
249
216
  - spec/models/project_spec.rb
217
+ - spec/models/create_order_request_spec.rb
218
+ - spec/models/order_spec.rb
250
219
  - spec/models/meta_index_object_spec.rb
220
+ - spec/models/project_list_response_spec.rb
251
221
  - spec/models/order_list_response_spec.rb
252
222
  - spec/patch_ruby_spec.rb
253
223
  - spec/spec_helper.rb