patch_ruby 1.19.0 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_order_request.rb +43 -4
- data/lib/patch_ruby/version.rb +1 -1
- data/spec/integration/orders_spec.rb +10 -1
- data/spec/models/create_order_request_spec.rb +3 -1
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e38c237237f243dcdefd64f39b87d2f052f5df647ba2c160971f68757bfdfc4
|
4
|
+
data.tar.gz: b129e13caef807d8c28ec975173881fb78a39df1a2c979d55958e3409a262f8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2e3c8486b47e5a3b7c7f7fd773f83773ffcab9da7c11d0fa04ea0ec29127179b81d76d68e383a2a4816aeb26fef7e23243e2c32b8b48b09f285e1d0f235383
|
7
|
+
data.tar.gz: 0a7d3ce9b60026bfaab7687785e34f4397e7d7c4fb5fe4095b8003918f32cae12bfe092ef426b6ba580ad5cfafae408b02fd2b06675600a400249496294146f7
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ 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.20.0] - 2022-04-18
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Adds optional `vintage_year` field to `order` creation
|
13
|
+
|
8
14
|
## [1.19.0] - 2022-04-05
|
9
15
|
|
10
16
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -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/1.
|
34
|
+
@user_agent = "patch-ruby/1.20.0"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
@@ -25,6 +25,8 @@ module Patch
|
|
25
25
|
|
26
26
|
attr_accessor :state
|
27
27
|
|
28
|
+
attr_accessor :vintage_year
|
29
|
+
|
28
30
|
class EnumAttributeValidator
|
29
31
|
attr_reader :datatype
|
30
32
|
attr_reader :allowable_values
|
@@ -54,7 +56,8 @@ module Patch
|
|
54
56
|
:'total_price_cents_usd' => :'total_price_cents_usd',
|
55
57
|
:'project_id' => :'project_id',
|
56
58
|
:'metadata' => :'metadata',
|
57
|
-
:'state' => :'state'
|
59
|
+
:'state' => :'state',
|
60
|
+
:'vintage_year' => :'vintage_year'
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
@@ -70,13 +73,20 @@ module Patch
|
|
70
73
|
:'total_price_cents_usd' => :'Integer',
|
71
74
|
:'project_id' => :'String',
|
72
75
|
:'metadata' => :'Object',
|
73
|
-
:'state' => :'String'
|
76
|
+
:'state' => :'String',
|
77
|
+
:'vintage_year' => :'Integer'
|
74
78
|
}
|
75
79
|
end
|
76
80
|
|
77
81
|
# List of attributes with nullable: true
|
78
82
|
def self.openapi_nullable
|
79
83
|
Set.new([
|
84
|
+
:'mass_g',
|
85
|
+
:'total_price_cents_usd',
|
86
|
+
:'project_id',
|
87
|
+
:'metadata',
|
88
|
+
:'state',
|
89
|
+
:'vintage_year'
|
80
90
|
])
|
81
91
|
end
|
82
92
|
|
@@ -126,6 +136,10 @@ module Patch
|
|
126
136
|
if attributes.key?(:'state')
|
127
137
|
self.state = attributes[:'state']
|
128
138
|
end
|
139
|
+
|
140
|
+
if attributes.key?(:'vintage_year')
|
141
|
+
self.vintage_year = attributes[:'vintage_year']
|
142
|
+
end
|
129
143
|
end
|
130
144
|
|
131
145
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -144,6 +158,14 @@ module Patch
|
|
144
158
|
invalid_properties.push('invalid value for "total_price_cents_usd", must be greater than or equal to 1.')
|
145
159
|
end
|
146
160
|
|
161
|
+
if !@vintage_year.nil? && @vintage_year > 2100
|
162
|
+
invalid_properties.push('invalid value for "vintage_year", must be smaller than or equal to 2100.')
|
163
|
+
end
|
164
|
+
|
165
|
+
if !@vintage_year.nil? && @vintage_year < 1900
|
166
|
+
invalid_properties.push('invalid value for "vintage_year", must be greater than or equal to 1900.')
|
167
|
+
end
|
168
|
+
|
147
169
|
invalid_properties
|
148
170
|
end
|
149
171
|
|
@@ -155,6 +177,8 @@ module Patch
|
|
155
177
|
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
156
178
|
state_validator = EnumAttributeValidator.new('String', ["draft", "placed"])
|
157
179
|
return false unless state_validator.valid?(@state)
|
180
|
+
return false if !@vintage_year.nil? && @vintage_year > 2100
|
181
|
+
return false if !@vintage_year.nil? && @vintage_year < 1900
|
158
182
|
true
|
159
183
|
end
|
160
184
|
|
@@ -192,6 +216,20 @@ module Patch
|
|
192
216
|
@state = state
|
193
217
|
end
|
194
218
|
|
219
|
+
# Custom attribute writer method with validation
|
220
|
+
# @param [Object] vintage_year Value to be assigned
|
221
|
+
def vintage_year=(vintage_year)
|
222
|
+
if !vintage_year.nil? && vintage_year > 2100
|
223
|
+
fail ArgumentError, 'invalid value for "vintage_year", must be smaller than or equal to 2100.'
|
224
|
+
end
|
225
|
+
|
226
|
+
if !vintage_year.nil? && vintage_year < 1900
|
227
|
+
fail ArgumentError, 'invalid value for "vintage_year", must be greater than or equal to 1900.'
|
228
|
+
end
|
229
|
+
|
230
|
+
@vintage_year = vintage_year
|
231
|
+
end
|
232
|
+
|
195
233
|
# Checks equality by comparing each attribute.
|
196
234
|
# @param [Object] Object to be compared
|
197
235
|
def ==(o)
|
@@ -201,7 +239,8 @@ module Patch
|
|
201
239
|
total_price_cents_usd == o.total_price_cents_usd &&
|
202
240
|
project_id == o.project_id &&
|
203
241
|
metadata == o.metadata &&
|
204
|
-
state == o.state
|
242
|
+
state == o.state &&
|
243
|
+
vintage_year == o.vintage_year
|
205
244
|
end
|
206
245
|
|
207
246
|
# @see the `==` method
|
@@ -213,7 +252,7 @@ module Patch
|
|
213
252
|
# Calculates hash code according to all attributes.
|
214
253
|
# @return [Integer] Hash code
|
215
254
|
def hash
|
216
|
-
[mass_g, total_price_cents_usd, project_id, metadata, state].hash
|
255
|
+
[mass_g, total_price_cents_usd, project_id, metadata, state, vintage_year].hash
|
217
256
|
end
|
218
257
|
|
219
258
|
# Builds the object from hash
|
data/lib/patch_ruby/version.rb
CHANGED
@@ -94,7 +94,7 @@ RSpec.describe 'Orders Integration' do
|
|
94
94
|
expect(create_order_response.data.state).to eq("draft")
|
95
95
|
end
|
96
96
|
|
97
|
-
|
97
|
+
it 'supports place and cancel for orders created via an estimate' do
|
98
98
|
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100, create_order: true)
|
99
99
|
order_to_place_id = create_estimate_to_place_response.data.order.id
|
100
100
|
|
@@ -107,4 +107,13 @@ RSpec.describe 'Orders Integration' do
|
|
107
107
|
cancel_order_response = Patch::Order.cancel_order(order_to_cancel_id)
|
108
108
|
expect(cancel_order_response.data.state).to eq 'cancelled'
|
109
109
|
end
|
110
|
+
|
111
|
+
it 'supports create with a vintage year' do
|
112
|
+
create_order_response =
|
113
|
+
Patch::Order.create_order(mass_g: 100, vintage_year: 2022)
|
114
|
+
|
115
|
+
expect(create_order_response.success).to eq true
|
116
|
+
expect(create_order_response.data.id).not_to be_nil
|
117
|
+
expect(create_order_response.data.mass_g).to eq(100)
|
118
|
+
end
|
110
119
|
end
|
@@ -30,7 +30,9 @@ describe 'CreateOrderRequest' do
|
|
30
30
|
it_behaves_like "a generated class" do
|
31
31
|
let(:instance) { @instance }
|
32
32
|
let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g, total_price_cents_usd: @instance.total_price_cents_usd, metadata: @instance.metadata } }
|
33
|
-
let(:nullable_properties)
|
33
|
+
let(:nullable_properties) do
|
34
|
+
Set.new(%i[mass_g total_price_cents_usd project_id metadata state vintage_year])
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
38
|
describe 'test an instance of CreateOrderRequest' 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.
|
4
|
+
version: 1.20.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: 2022-04-
|
11
|
+
date: 2022-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -199,48 +199,48 @@ signing_key:
|
|
199
199
|
specification_version: 4
|
200
200
|
summary: Ruby wrapper for the Patch API
|
201
201
|
test_files:
|
202
|
-
- spec/api/projects_api_spec.rb
|
203
|
-
- spec/api/estimates_api_spec.rb
|
204
202
|
- spec/api/technology_types_api_spec.rb
|
205
203
|
- spec/api/orders_api_spec.rb
|
204
|
+
- spec/api/estimates_api_spec.rb
|
205
|
+
- spec/api/projects_api_spec.rb
|
206
206
|
- spec/api_client_spec.rb
|
207
207
|
- spec/configuration_spec.rb
|
208
208
|
- spec/constants.rb
|
209
|
-
- spec/factories/
|
210
|
-
- spec/factories/orders.rb
|
211
|
-
- spec/factories/estimates.rb
|
212
|
-
- spec/factories/create_order_requests.rb
|
209
|
+
- spec/factories/allocations.rb
|
213
210
|
- spec/factories/create_mass_estimate_requests.rb
|
211
|
+
- spec/factories/meta_index_objects.rb
|
214
212
|
- spec/factories/estimate_list_responses.rb
|
213
|
+
- spec/factories/order_list_responses.rb
|
214
|
+
- spec/factories/parent_technology_type.rb
|
215
|
+
- spec/factories/create_order_requests.rb
|
216
|
+
- spec/factories/sdgs.rb
|
215
217
|
- spec/factories/order_responses.rb
|
216
|
-
- spec/factories/
|
218
|
+
- spec/factories/orders.rb
|
217
219
|
- spec/factories/technology_type.rb
|
218
|
-
- spec/factories/parent_technology_type.rb
|
219
|
-
- spec/factories/order_list_responses.rb
|
220
|
-
- spec/factories/error_responses.rb
|
221
|
-
- spec/factories/allocations.rb
|
222
220
|
- spec/factories/project_responses.rb
|
223
|
-
- spec/factories/sdgs.rb
|
224
221
|
- spec/factories/estimate_responses.rb
|
225
|
-
- spec/factories/
|
226
|
-
- spec/
|
222
|
+
- spec/factories/project_list_responses.rb
|
223
|
+
- spec/factories/error_responses.rb
|
224
|
+
- spec/factories/projects.rb
|
225
|
+
- spec/factories/estimates.rb
|
227
226
|
- spec/integration/estimates_spec.rb
|
228
|
-
- spec/integration/orders_spec.rb
|
229
227
|
- spec/integration/projects/technology_types_spec.rb
|
230
|
-
- spec/
|
228
|
+
- spec/integration/projects_spec.rb
|
229
|
+
- spec/integration/orders_spec.rb
|
230
|
+
- spec/models/project_response_spec.rb
|
231
|
+
- spec/models/project_list_response_spec.rb
|
231
232
|
- spec/models/create_order_request_spec.rb
|
232
|
-
- spec/models/
|
233
|
-
- spec/models/
|
234
|
-
- spec/models/order_list_response_spec.rb
|
235
|
-
- spec/models/order_response_spec.rb
|
236
|
-
- spec/models/estimate_response_spec.rb
|
237
|
-
- spec/models/order_spec.rb
|
233
|
+
- spec/models/estimate_list_response_spec.rb
|
234
|
+
- spec/models/estimate_spec.rb
|
238
235
|
- spec/models/project_spec.rb
|
239
|
-
- spec/models/
|
240
|
-
- spec/models/project_response_spec.rb
|
236
|
+
- spec/models/order_response_spec.rb
|
241
237
|
- spec/models/allocation_spec.rb
|
242
238
|
- spec/models/meta_index_object_spec.rb
|
243
|
-
- spec/models/
|
239
|
+
- spec/models/error_response_spec.rb
|
240
|
+
- spec/models/estimate_response_spec.rb
|
241
|
+
- spec/models/create_mass_estimate_request_spec.rb
|
242
|
+
- spec/models/order_list_response_spec.rb
|
243
|
+
- spec/models/order_spec.rb
|
244
244
|
- spec/patch_ruby_spec.rb
|
245
245
|
- spec/spec_helper.rb
|
246
246
|
- spec/support/shared/generated_classes.rb
|