Skip to content

Commit

Permalink
API version 2.1.0 See https://docs.patch.io/#/changelog for changes (#73
Browse files Browse the repository at this point in the history
)

* API version 2.1.0 See https://docs.patch.io/#/changelog for changes

* Use swagger version 2

* Update expected test results for estimates

* Update changelog
  • Loading branch information
venalen authored Apr 4, 2023
1 parent ed569b9 commit 9f8b01e
Show file tree
Hide file tree
Showing 16 changed files with 363 additions and 39 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0] - 2023-04-04

### Added

- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order` creation
- Adds optional `vintage_start_year` and `vintage_end_year` fields to `order_line_item` create and update
- Adds optional `vintage_start_year` and `vintage_end_year` fields to `inventory` creation
- Adds `vintage_start_year` and `vintage_end_year` fields to `order` response
- Adds `vintage_start_year` and `vintage_end_year` fields to `order_line_item` response
- Adds optional `carrier_scac` field to `Patch::Estimate.create_road_shipping_estimate` method
- Deprecates `Patch::Estimate.create_shipping_estimate` in favor of `Patch::Estimate.create_ecommerce_estimate`

## [1.24.2] - 2022-08-10

### Added
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
patch_ruby (2.0.0)
patch_ruby (2.1.0)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand All @@ -17,7 +17,7 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.2.2)
diff-lcs (1.4.4)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -70,6 +70,7 @@ GEM
PLATFORMS
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-20
x86_64-darwin-21
x86_64-linux
Expand Down
2 changes: 1 addition & 1 deletion lib/patch_ruby/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ApiClient
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
def initialize(config = Configuration.default)
@config = config
@user_agent = "patch-ruby/2.0.0"
@user_agent = "patch-ruby/2.1.0"
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
Expand Down
3 changes: 1 addition & 2 deletions lib/patch_ruby/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ def server_settings
end

def operation_server_settings
{
}
{}
end

# Returns URL based on server settings
Expand Down
10 changes: 5 additions & 5 deletions lib/patch_ruby/models/create_mass_estimate_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def list_invalid_properties
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
end

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

if @mass_g < 0
Expand All @@ -116,7 +116,7 @@ def list_invalid_properties
# @return true if the model is valid
def valid?
return false if @mass_g.nil?
return false if @mass_g > 100000000000
return false if @mass_g > 100000000000000
return false if @mass_g < 0
true
end
Expand All @@ -128,8 +128,8 @@ def mass_g=(mass_g)
fail ArgumentError, 'mass_g cannot be nil'
end

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

if mass_g < 0
Expand Down
80 changes: 74 additions & 6 deletions lib/patch_ruby/models/create_order_line_item_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class CreateOrderLineItemRequest

attr_accessor :vintage_year

attr_accessor :vintage_start_year

attr_accessor :vintage_end_year

attr_accessor :price

attr_accessor :currency
Expand Down Expand Up @@ -54,6 +58,8 @@ def self.attribute_map
{
:'project_id' => :'project_id',
:'vintage_year' => :'vintage_year',
:'vintage_start_year' => :'vintage_start_year',
:'vintage_end_year' => :'vintage_end_year',
:'price' => :'price',
:'currency' => :'currency',
:'amount' => :'amount',
Expand All @@ -71,6 +77,8 @@ def self.openapi_types
{
:'project_id' => :'String',
:'vintage_year' => :'Integer',
:'vintage_start_year' => :'Integer',
:'vintage_end_year' => :'Integer',
:'price' => :'Integer',
:'currency' => :'String',
:'amount' => :'Integer',
Expand All @@ -82,6 +90,8 @@ def self.openapi_types
def self.openapi_nullable
Set.new([
:'vintage_year',
:'vintage_start_year',
:'vintage_end_year',
:'price',
:'currency',
:'amount',
Expand Down Expand Up @@ -124,6 +134,14 @@ def initialize(attributes = {})
self.vintage_year = attributes[:'vintage_year']
end

if attributes.key?(:'vintage_start_year')
self.vintage_start_year = attributes[:'vintage_start_year']
end

if attributes.key?(:'vintage_end_year')
self.vintage_end_year = attributes[:'vintage_end_year']
end

if attributes.key?(:'price')
self.price = attributes[:'price']
end
Expand Down Expand Up @@ -153,12 +171,28 @@ def list_invalid_properties
invalid_properties.push('invalid value for "vintage_year", must be greater than or equal to 1900.')
end

if !@vintage_start_year.nil? && @vintage_start_year > 2100
invalid_properties.push('invalid value for "vintage_start_year", must be smaller than or equal to 2100.')
end

if !@vintage_start_year.nil? && @vintage_start_year < 1900
invalid_properties.push('invalid value for "vintage_start_year", must be greater than or equal to 1900.')
end

if !@vintage_end_year.nil? && @vintage_end_year > 2100
invalid_properties.push('invalid value for "vintage_end_year", must be smaller than or equal to 2100.')
end

if !@vintage_end_year.nil? && @vintage_end_year < 1900
invalid_properties.push('invalid value for "vintage_end_year", must be greater than or equal to 1900.')
end

if !@price.nil? && @price < 2
invalid_properties.push('invalid value for "price", must be greater than or equal to 2.')
end

if !@amount.nil? && @amount > 100000000000
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000.')
if !@amount.nil? && @amount > 100000000000000
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000000.')
end

if !@amount.nil? && @amount < 0
Expand All @@ -173,8 +207,12 @@ def list_invalid_properties
def valid?
return false if !@vintage_year.nil? && @vintage_year > 2100
return false if !@vintage_year.nil? && @vintage_year < 1900
return false if !@vintage_start_year.nil? && @vintage_start_year > 2100
return false if !@vintage_start_year.nil? && @vintage_start_year < 1900
return false if !@vintage_end_year.nil? && @vintage_end_year > 2100
return false if !@vintage_end_year.nil? && @vintage_end_year < 1900
return false if !@price.nil? && @price < 2
return false if !@amount.nil? && @amount > 100000000000
return false if !@amount.nil? && @amount > 100000000000000
return false if !@amount.nil? && @amount < 0
unit_validator = EnumAttributeValidator.new('String', ["g", "Wh"])
return false unless unit_validator.valid?(@unit)
Expand All @@ -195,6 +233,34 @@ def vintage_year=(vintage_year)
@vintage_year = vintage_year
end

# Custom attribute writer method with validation
# @param [Object] vintage_start_year Value to be assigned
def vintage_start_year=(vintage_start_year)
if !vintage_start_year.nil? && vintage_start_year > 2100
fail ArgumentError, 'invalid value for "vintage_start_year", must be smaller than or equal to 2100.'
end

if !vintage_start_year.nil? && vintage_start_year < 1900
fail ArgumentError, 'invalid value for "vintage_start_year", must be greater than or equal to 1900.'
end

@vintage_start_year = vintage_start_year
end

# Custom attribute writer method with validation
# @param [Object] vintage_end_year Value to be assigned
def vintage_end_year=(vintage_end_year)
if !vintage_end_year.nil? && vintage_end_year > 2100
fail ArgumentError, 'invalid value for "vintage_end_year", must be smaller than or equal to 2100.'
end

if !vintage_end_year.nil? && vintage_end_year < 1900
fail ArgumentError, 'invalid value for "vintage_end_year", must be greater than or equal to 1900.'
end

@vintage_end_year = vintage_end_year
end

# Custom attribute writer method with validation
# @param [Object] price Value to be assigned
def price=(price)
Expand All @@ -208,8 +274,8 @@ def price=(price)
# Custom attribute writer method with validation
# @param [Object] amount Value to be assigned
def amount=(amount)
if !amount.nil? && amount > 100000000000
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000.'
if !amount.nil? && amount > 100000000000000
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000000.'
end

if !amount.nil? && amount < 0
Expand All @@ -236,6 +302,8 @@ def ==(o)
self.class == o.class &&
project_id == o.project_id &&
vintage_year == o.vintage_year &&
vintage_start_year == o.vintage_start_year &&
vintage_end_year == o.vintage_end_year &&
price == o.price &&
currency == o.currency &&
amount == o.amount &&
Expand All @@ -251,7 +319,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[project_id, vintage_year, price, currency, amount, unit].hash
[project_id, vintage_year, vintage_start_year, vintage_end_year, price, currency, amount, unit].hash
end

# Builds the object from hash
Expand Down
Loading

0 comments on commit 9f8b01e

Please sign in to comment.