Skip to content

Commit 6a33347

Browse files
authored
Merge pull request #10 from patch-technology/lovisa/bump-version
2 parents 756a018 + 9288298 commit 6a33347

12 files changed

+624
-7
lines changed

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Layout/SpaceInsideParens:
113113
# EnforcedStyle: single_quotes
114114

115115
# Detect hard tabs, no hard tabs.
116-
Layout/IndentationStyle:
116+
Layout/Tab:
117117
Enabled: true
118118

119119
# Blank lines should not have any spaces.

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.0] - 2020-09-17
11+
12+
### Added
13+
14+
- `photos` field to `projects`
15+
- `average_price_per_tonne_cents_usd` field to `projects`
16+
- `remaining_mass_g` field to `projects`
17+
- `standard` field to `projects`
18+
- validations on `mass_g` field (has to be greater than 1 and less than 2,000,000,000).
19+
1020
## [1.1.0] - 2020-08-19
1121

1222
### Added

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
patch_ruby (1.1.0)
4+
patch_ruby (1.2.0)
55
json (~> 2.1, >= 2.1.0)
66
typhoeus (~> 1.0, >= 1.0.1)
77

lib/patch_ruby.rb

+2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
require 'patch_ruby/models/order'
3030
require 'patch_ruby/models/order_list_response'
3131
require 'patch_ruby/models/order_response'
32+
require 'patch_ruby/models/photo'
3233
require 'patch_ruby/models/preference'
3334
require 'patch_ruby/models/preference_list_response'
3435
require 'patch_ruby/models/preference_response'
3536
require 'patch_ruby/models/project'
3637
require 'patch_ruby/models/project_list_response'
3738
require 'patch_ruby/models/project_response'
39+
require 'patch_ruby/models/standard'
3840

3941
# APIs
4042
require 'patch_ruby/api/estimates_api'

lib/patch_ruby/models/create_mass_estimate_request.rb

+28
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,44 @@ def list_invalid_properties
7777
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
7878
end
7979

80+
if @mass_g > 2000000000
81+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
82+
end
83+
84+
if @mass_g < 1
85+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
86+
end
87+
8088
invalid_properties
8189
end
8290

8391
# Check to see if the all the properties in the model are valid
8492
# @return true if the model is valid
8593
def valid?
8694
return false if @mass_g.nil?
95+
return false if @mass_g > 2000000000
96+
return false if @mass_g < 1
8797
true
8898
end
8999

100+
# Custom attribute writer method with validation
101+
# @param [Object] mass_g Value to be assigned
102+
def mass_g=(mass_g)
103+
if mass_g.nil?
104+
fail ArgumentError, 'mass_g cannot be nil'
105+
end
106+
107+
if mass_g > 2000000000
108+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
109+
end
110+
111+
if mass_g < 1
112+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
113+
end
114+
115+
@mass_g = mass_g
116+
end
117+
90118
# Checks equality by comparing each attribute.
91119
# @param [Object] Object to be compared
92120
def ==(o)

lib/patch_ruby/models/create_order_request.rb

+28
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,44 @@ def list_invalid_properties
8585
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
8686
end
8787

88+
if @mass_g > 2000000000
89+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
90+
end
91+
92+
if @mass_g < 1
93+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
94+
end
95+
8896
invalid_properties
8997
end
9098

9199
# Check to see if the all the properties in the model are valid
92100
# @return true if the model is valid
93101
def valid?
94102
return false if @mass_g.nil?
103+
return false if @mass_g > 2000000000
104+
return false if @mass_g < 1
95105
true
96106
end
97107

108+
# Custom attribute writer method with validation
109+
# @param [Object] mass_g Value to be assigned
110+
def mass_g=(mass_g)
111+
if mass_g.nil?
112+
fail ArgumentError, 'mass_g cannot be nil'
113+
end
114+
115+
if mass_g > 2000000000
116+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
117+
end
118+
119+
if mass_g < 1
120+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
121+
end
122+
123+
@mass_g = mass_g
124+
end
125+
98126
# Checks equality by comparing each attribute.
99127
# @param [Object] Object to be compared
100128
def ==(o)

lib/patch_ruby/models/order.rb

+28
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ def list_invalid_properties
153153
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
154154
end
155155

156+
if @mass_g > 2000000000
157+
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
158+
end
159+
160+
if @mass_g < 1
161+
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
162+
end
163+
156164
if @production.nil?
157165
invalid_properties.push('invalid value for "production", production cannot be nil.')
158166
end
@@ -181,6 +189,8 @@ def list_invalid_properties
181189
def valid?
182190
return false if @id.nil?
183191
return false if @mass_g.nil?
192+
return false if @mass_g > 2000000000
193+
return false if @mass_g < 1
184194
return false if @production.nil?
185195
return false if @state.nil?
186196
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
@@ -193,6 +203,24 @@ def valid?
193203
true
194204
end
195205

206+
# Custom attribute writer method with validation
207+
# @param [Object] mass_g Value to be assigned
208+
def mass_g=(mass_g)
209+
if mass_g.nil?
210+
fail ArgumentError, 'mass_g cannot be nil'
211+
end
212+
213+
if mass_g > 2000000000
214+
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
215+
end
216+
217+
if mass_g < 1
218+
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
219+
end
220+
221+
@mass_g = mass_g
222+
end
223+
196224
# Custom attribute writer method checking allowed values (enum).
197225
# @param [Object] state Object to be assigned
198226
def state=(state)

0 commit comments

Comments
 (0)