patch_ruby 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -3
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +5 -5
- data/lib/patch_ruby/models/create_order_request.rb +5 -5
- data/lib/patch_ruby/models/order.rb +5 -5
- data/lib/patch_ruby/models/project.rb +3 -3
- data/lib/patch_ruby/version.rb +1 -1
- data/spec/integration/orders_spec.rb +5 -4
- metadata +29 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc6db1f9c2667e24cdcc6e9d1e0f3b4866572a98ffe6131329772cc75c140aa4
|
4
|
+
data.tar.gz: d3db3c6c7ac66a2b41516a52187a373cc8fa8efa9df1bd12e7cb163d6b83a31f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f63cd496d573267bb060c8470ae80856b1b1865a28aea4bbd800866ae19612b05aaf6177cdd5e3155707817d594900dc68a61c014c3485b43615d02090495599
|
7
|
+
data.tar.gz: fa029a9b055376f7b7c0f873691f5adf1530fbd72548aa505d384bf4ceabd8f4a769eb0c90f46c53cff71e198af144ac0ec3a344e48c2b63aa772d6c912824b9
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ 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
|
+
## [1.5.2] - 2021-03-30
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Updated the value validation for certain parameters to match the API
|
13
|
+
- Added the `renewables` type
|
14
|
+
|
8
15
|
## [1.5.1] - 2021-03-02
|
9
16
|
|
10
17
|
### Fixed
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
patch_ruby (1.5.
|
4
|
+
patch_ruby (1.5.2)
|
5
5
|
json (~> 2.1, >= 2.1.0)
|
6
6
|
typhoeus (~> 1.0, >= 1.0.1)
|
7
7
|
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
ffi (>= 1.3.0)
|
24
24
|
factory_bot (6.1.0)
|
25
25
|
activesupport (>= 5.0.0)
|
26
|
-
ffi (1.
|
26
|
+
ffi (1.15.0)
|
27
27
|
i18n (1.8.7)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
29
|
json (2.5.1)
|
@@ -86,4 +86,4 @@ DEPENDENCIES
|
|
86
86
|
rubocop
|
87
87
|
|
88
88
|
BUNDLED WITH
|
89
|
-
2.
|
89
|
+
2.2.14
|
@@ -98,8 +98,8 @@ module Patch
|
|
98
98
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
99
99
|
end
|
100
100
|
|
101
|
-
if @mass_g <
|
102
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
101
|
+
if @mass_g < 0
|
102
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
103
103
|
end
|
104
104
|
|
105
105
|
invalid_properties
|
@@ -110,7 +110,7 @@ module Patch
|
|
110
110
|
def valid?
|
111
111
|
return false if @mass_g.nil?
|
112
112
|
return false if @mass_g > 2000000000
|
113
|
-
return false if @mass_g <
|
113
|
+
return false if @mass_g < 0
|
114
114
|
true
|
115
115
|
end
|
116
116
|
|
@@ -125,8 +125,8 @@ module Patch
|
|
125
125
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
126
126
|
end
|
127
127
|
|
128
|
-
if mass_g <
|
129
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
128
|
+
if mass_g < 0
|
129
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
130
130
|
end
|
131
131
|
|
132
132
|
@mass_g = mass_g
|
@@ -100,8 +100,8 @@ module Patch
|
|
100
100
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
101
101
|
end
|
102
102
|
|
103
|
-
if !@mass_g.nil? && @mass_g <
|
104
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
103
|
+
if !@mass_g.nil? && @mass_g < 0
|
104
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
105
105
|
end
|
106
106
|
|
107
107
|
if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
@@ -115,7 +115,7 @@ module Patch
|
|
115
115
|
# @return true if the model is valid
|
116
116
|
def valid?
|
117
117
|
return false if !@mass_g.nil? && @mass_g > 2000000000
|
118
|
-
return false if !@mass_g.nil? && @mass_g <
|
118
|
+
return false if !@mass_g.nil? && @mass_g < 0
|
119
119
|
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
120
120
|
true
|
121
121
|
end
|
@@ -127,8 +127,8 @@ module Patch
|
|
127
127
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
128
128
|
end
|
129
129
|
|
130
|
-
if !mass_g.nil? && mass_g <
|
131
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
130
|
+
if !mass_g.nil? && mass_g < 0
|
131
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
132
132
|
end
|
133
133
|
|
134
134
|
@mass_g = mass_g
|
@@ -185,8 +185,8 @@ module Patch
|
|
185
185
|
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
|
186
186
|
end
|
187
187
|
|
188
|
-
if @mass_g <
|
189
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to
|
188
|
+
if @mass_g < 0
|
189
|
+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
190
190
|
end
|
191
191
|
|
192
192
|
if @production.nil?
|
@@ -218,7 +218,7 @@ module Patch
|
|
218
218
|
return false if @id.nil?
|
219
219
|
return false if @mass_g.nil?
|
220
220
|
return false if @mass_g > 2000000000
|
221
|
-
return false if @mass_g <
|
221
|
+
return false if @mass_g < 0
|
222
222
|
return false if @production.nil?
|
223
223
|
return false if @state.nil?
|
224
224
|
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
|
@@ -242,8 +242,8 @@ module Patch
|
|
242
242
|
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
|
243
243
|
end
|
244
244
|
|
245
|
-
if mass_g <
|
246
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to
|
245
|
+
if mass_g < 0
|
246
|
+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
247
247
|
end
|
248
248
|
|
249
249
|
@mass_g = mass_g
|
@@ -26,7 +26,7 @@ module Patch
|
|
26
26
|
# The description of the project.
|
27
27
|
attr_accessor :description
|
28
28
|
|
29
|
-
# The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Soil.
|
29
|
+
# The type of carbon removal project, currently available project types are Biomass, Dac, Forestry, Mineralization, Ocean, Renewables, Soil.
|
30
30
|
attr_accessor :type
|
31
31
|
|
32
32
|
# The country of origin of the project.
|
@@ -246,7 +246,7 @@ module Patch
|
|
246
246
|
return false if @production.nil?
|
247
247
|
return false if @name.nil?
|
248
248
|
return false if @description.nil?
|
249
|
-
type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
|
249
|
+
type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
250
250
|
return false unless type_validator.valid?(@type)
|
251
251
|
return false if @country.nil?
|
252
252
|
return false if @developer.nil?
|
@@ -258,7 +258,7 @@ module Patch
|
|
258
258
|
# Custom attribute writer method checking allowed values (enum).
|
259
259
|
# @param [Object] type Object to be assigned
|
260
260
|
def type=(type)
|
261
|
-
validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "soil"])
|
261
|
+
validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
262
262
|
unless validator.valid?(type)
|
263
263
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
264
264
|
end
|
data/lib/patch_ruby/version.rb
CHANGED
@@ -40,11 +40,12 @@ RSpec.describe 'Orders Integration' do
|
|
40
40
|
|
41
41
|
create_order_response = Patch::Order.create_order(mass_g: order_mass_g, project_id: project_id)
|
42
42
|
|
43
|
+
order = create_order_response.data
|
43
44
|
expect(create_order_response.success).to eq true
|
44
|
-
expect(
|
45
|
-
expect(
|
46
|
-
expect(
|
47
|
-
expect(
|
45
|
+
expect(order.id).not_to be_nil
|
46
|
+
expect(order.mass_g).to eq(order_mass_g)
|
47
|
+
expect(order.price_cents_usd.to_i).to be_between(expected_price - 1, expected_price + 1)
|
48
|
+
expect(order.patch_fee_cents_usd).not_to be_empty
|
48
49
|
end
|
49
50
|
|
50
51
|
it 'supports create with a total price' do
|
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: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patch Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -188,53 +188,53 @@ signing_key:
|
|
188
188
|
specification_version: 4
|
189
189
|
summary: Ruby wrapper for the Patch API
|
190
190
|
test_files:
|
191
|
-
- spec/api/orders_api_spec.rb
|
192
|
-
- spec/api/projects_api_spec.rb
|
193
|
-
- spec/api/estimates_api_spec.rb
|
194
191
|
- spec/api/preferences_api_spec.rb
|
192
|
+
- spec/api/estimates_api_spec.rb
|
193
|
+
- spec/api/projects_api_spec.rb
|
194
|
+
- spec/api/orders_api_spec.rb
|
195
195
|
- spec/api_client_spec.rb
|
196
196
|
- spec/configuration_spec.rb
|
197
197
|
- spec/constants.rb
|
198
|
-
- spec/factories/
|
199
|
-
- spec/factories/create_preference_requests.rb
|
200
|
-
- spec/factories/meta_index_objects.rb
|
201
|
-
- spec/factories/project_list_responses.rb
|
202
|
-
- spec/factories/orders.rb
|
203
|
-
- spec/factories/order_list_responses.rb
|
198
|
+
- spec/factories/preference_list_responses.rb
|
204
199
|
- spec/factories/order_responses.rb
|
205
|
-
- spec/factories/
|
206
|
-
- spec/factories/preference_responses.rb
|
200
|
+
- spec/factories/projects.rb
|
207
201
|
- spec/factories/error_responses.rb
|
208
|
-
- spec/factories/
|
209
|
-
- spec/factories/estimate_list_responses.rb
|
202
|
+
- spec/factories/orders.rb
|
210
203
|
- spec/factories/create_order_requests.rb
|
204
|
+
- spec/factories/create_mass_estimate_requests.rb
|
205
|
+
- spec/factories/project_responses.rb
|
206
|
+
- spec/factories/estimate_list_responses.rb
|
207
|
+
- spec/factories/order_list_responses.rb
|
208
|
+
- spec/factories/create_preference_requests.rb
|
211
209
|
- spec/factories/allocations.rb
|
212
|
-
- spec/factories/
|
210
|
+
- spec/factories/preferences.rb
|
211
|
+
- spec/factories/project_list_responses.rb
|
212
|
+
- spec/factories/estimates.rb
|
213
|
+
- spec/factories/preference_responses.rb
|
213
214
|
- spec/factories/estimate_responses.rb
|
214
|
-
- spec/factories/
|
215
|
-
- spec/factories/create_mass_estimate_requests.rb
|
215
|
+
- spec/factories/meta_index_objects.rb
|
216
216
|
- spec/integration/estimates_spec.rb
|
217
|
-
- spec/integration/preferences_spec.rb
|
218
217
|
- spec/integration/orders_spec.rb
|
218
|
+
- spec/integration/preferences_spec.rb
|
219
219
|
- spec/integration/projects_spec.rb
|
220
|
-
- spec/models/
|
220
|
+
- spec/models/create_order_request_spec.rb
|
221
|
+
- spec/models/create_mass_estimate_request_spec.rb
|
222
|
+
- spec/models/order_spec.rb
|
221
223
|
- spec/models/allocation_spec.rb
|
222
|
-
- spec/models/
|
223
|
-
- spec/models/preference_list_response_spec.rb
|
224
|
-
- spec/models/create_preference_request_spec.rb
|
224
|
+
- spec/models/order_list_response_spec.rb
|
225
225
|
- spec/models/estimate_list_response_spec.rb
|
226
|
-
- spec/models/
|
226
|
+
- spec/models/error_response_spec.rb
|
227
227
|
- spec/models/project_list_response_spec.rb
|
228
|
-
- spec/models/estimate_response_spec.rb
|
229
228
|
- spec/models/preference_spec.rb
|
230
|
-
- spec/models/
|
231
|
-
- spec/models/
|
229
|
+
- spec/models/order_response_spec.rb
|
230
|
+
- spec/models/preference_list_response_spec.rb
|
231
|
+
- spec/models/create_preference_request_spec.rb
|
232
232
|
- spec/models/project_response_spec.rb
|
233
|
-
- spec/models/order_spec.rb
|
234
|
-
- spec/models/error_response_spec.rb
|
235
233
|
- spec/models/estimate_spec.rb
|
236
234
|
- spec/models/meta_index_object_spec.rb
|
237
235
|
- spec/models/preference_response_spec.rb
|
236
|
+
- spec/models/project_spec.rb
|
237
|
+
- spec/models/estimate_response_spec.rb
|
238
238
|
- spec/patch_ruby_spec.rb
|
239
239
|
- spec/spec_helper.rb
|
240
240
|
- spec/support/shared/generated_classes.rb
|