Skip to content

Commit

Permalink
Merge pull request #10 from patch-technology/lovisa/bump-version
Browse files Browse the repository at this point in the history
  • Loading branch information
biglovisa authored Sep 18, 2020
2 parents 756a018 + 9288298 commit 6a33347
Show file tree
Hide file tree
Showing 12 changed files with 624 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Layout/SpaceInsideParens:
# EnforcedStyle: single_quotes

# Detect hard tabs, no hard tabs.
Layout/IndentationStyle:
Layout/Tab:
Enabled: true

# Blank lines should not have any spaces.
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.0] - 2020-09-17

### Added

- `photos` field to `projects`
- `average_price_per_tonne_cents_usd` field to `projects`
- `remaining_mass_g` field to `projects`
- `standard` field to `projects`
- validations on `mass_g` field (has to be greater than 1 and less than 2,000,000,000).

## [1.1.0] - 2020-08-19

### Added
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
patch_ruby (1.1.0)
patch_ruby (1.2.0)
json (~> 2.1, >= 2.1.0)
typhoeus (~> 1.0, >= 1.0.1)

Expand Down
2 changes: 2 additions & 0 deletions lib/patch_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
require 'patch_ruby/models/order'
require 'patch_ruby/models/order_list_response'
require 'patch_ruby/models/order_response'
require 'patch_ruby/models/photo'
require 'patch_ruby/models/preference'
require 'patch_ruby/models/preference_list_response'
require 'patch_ruby/models/preference_response'
require 'patch_ruby/models/project'
require 'patch_ruby/models/project_list_response'
require 'patch_ruby/models/project_response'
require 'patch_ruby/models/standard'

# APIs
require 'patch_ruby/api/estimates_api'
Expand Down
28 changes: 28 additions & 0 deletions lib/patch_ruby/models/create_mass_estimate_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,44 @@ def list_invalid_properties
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
end

if @mass_g > 2000000000
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
end

if @mass_g < 1
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
end

invalid_properties
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @mass_g.nil?
return false if @mass_g > 2000000000
return false if @mass_g < 1
true
end

# Custom attribute writer method with validation
# @param [Object] mass_g Value to be assigned
def mass_g=(mass_g)
if mass_g.nil?
fail ArgumentError, 'mass_g cannot be nil'
end

if mass_g > 2000000000
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
end

if mass_g < 1
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
end

@mass_g = mass_g
end

# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
Expand Down
28 changes: 28 additions & 0 deletions lib/patch_ruby/models/create_order_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,44 @@ def list_invalid_properties
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
end

if @mass_g > 2000000000
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
end

if @mass_g < 1
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
end

invalid_properties
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @mass_g.nil?
return false if @mass_g > 2000000000
return false if @mass_g < 1
true
end

# Custom attribute writer method with validation
# @param [Object] mass_g Value to be assigned
def mass_g=(mass_g)
if mass_g.nil?
fail ArgumentError, 'mass_g cannot be nil'
end

if mass_g > 2000000000
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
end

if mass_g < 1
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
end

@mass_g = mass_g
end

# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
Expand Down
28 changes: 28 additions & 0 deletions lib/patch_ruby/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ def list_invalid_properties
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
end

if @mass_g > 2000000000
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 2000000000.')
end

if @mass_g < 1
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 1.')
end

if @production.nil?
invalid_properties.push('invalid value for "production", production cannot be nil.')
end
Expand Down Expand Up @@ -181,6 +189,8 @@ def list_invalid_properties
def valid?
return false if @id.nil?
return false if @mass_g.nil?
return false if @mass_g > 2000000000
return false if @mass_g < 1
return false if @production.nil?
return false if @state.nil?
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "complete", "cancelled"])
Expand All @@ -193,6 +203,24 @@ def valid?
true
end

# Custom attribute writer method with validation
# @param [Object] mass_g Value to be assigned
def mass_g=(mass_g)
if mass_g.nil?
fail ArgumentError, 'mass_g cannot be nil'
end

if mass_g > 2000000000
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 2000000000.'
end

if mass_g < 1
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 1.'
end

@mass_g = mass_g
end

# Custom attribute writer method checking allowed values (enum).
# @param [Object] state Object to be assigned
def state=(state)
Expand Down
Loading

0 comments on commit 6a33347

Please sign in to comment.