Skip to content

Commit

Permalink
Validate body parameters before making HTTP requests (#42)
Browse files Browse the repository at this point in the history
* Add new flights

* Fix

* Validate params

* Update changelog

* Update changelog

* Reduce blank
  • Loading branch information
pcothenet authored Sep 7, 2021
1 parent 4c820a7 commit 4dc0c0e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [1.11.1] - 2021-09-07

### Changed

- Body parameters are validated before being sent to the API. This gives developers faster feedback as they develop their applications.

## [1.11.0] - 2021-09-07

### 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.11.0)
patch_ruby (1.11.1)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand Down
32 changes: 20 additions & 12 deletions lib/patch_ruby/api/estimates_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def initialize(api_client = ApiClient.default)
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_bitcoin_estimate(create_bitcoin_estimate_request, opts = {})
data, _status_code, _headers = create_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, opts)
def create_bitcoin_estimate(create_bitcoin_estimate_request = {}, opts = {})
_create_bitcoin_estimate_request = Patch::CreateBitcoinEstimateRequest.new(create_bitcoin_estimate_request)
data, _status_code, _headers = create_bitcoin_estimate_with_http_info(_create_bitcoin_estimate_request, opts)
data
end

Expand Down Expand Up @@ -100,8 +101,9 @@ def create_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, opts
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_ethereum_estimate(create_ethereum_estimate_request, opts = {})
data, _status_code, _headers = create_ethereum_estimate_with_http_info(create_ethereum_estimate_request, opts)
def create_ethereum_estimate(create_ethereum_estimate_request = {}, opts = {})
_create_ethereum_estimate_request = Patch::CreateEthereumEstimateRequest.new(create_ethereum_estimate_request)
data, _status_code, _headers = create_ethereum_estimate_with_http_info(_create_ethereum_estimate_request, opts)
data
end

Expand Down Expand Up @@ -165,8 +167,9 @@ def create_ethereum_estimate_with_http_info(create_ethereum_estimate_request, op
# @param create_flight_estimate_request [CreateFlightEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_flight_estimate(create_flight_estimate_request, opts = {})
data, _status_code, _headers = create_flight_estimate_with_http_info(create_flight_estimate_request, opts)
def create_flight_estimate(create_flight_estimate_request = {}, opts = {})
_create_flight_estimate_request = Patch::CreateFlightEstimateRequest.new(create_flight_estimate_request)
data, _status_code, _headers = create_flight_estimate_with_http_info(_create_flight_estimate_request, opts)
data
end

Expand Down Expand Up @@ -230,8 +233,9 @@ def create_flight_estimate_with_http_info(create_flight_estimate_request, opts =
# @param create_mass_estimate_request [CreateMassEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_mass_estimate(create_mass_estimate_request, opts = {})
data, _status_code, _headers = create_mass_estimate_with_http_info(create_mass_estimate_request, opts)
def create_mass_estimate(create_mass_estimate_request = {}, opts = {})
_create_mass_estimate_request = Patch::CreateMassEstimateRequest.new(create_mass_estimate_request)
data, _status_code, _headers = create_mass_estimate_with_http_info(_create_mass_estimate_request, opts)
data
end

Expand Down Expand Up @@ -295,8 +299,9 @@ def create_mass_estimate_with_http_info(create_mass_estimate_request, opts = {})
# @param create_shipping_estimate_request [CreateShippingEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_shipping_estimate(create_shipping_estimate_request, opts = {})
data, _status_code, _headers = create_shipping_estimate_with_http_info(create_shipping_estimate_request, opts)
def create_shipping_estimate(create_shipping_estimate_request = {}, opts = {})
_create_shipping_estimate_request = Patch::CreateShippingEstimateRequest.new(create_shipping_estimate_request)
data, _status_code, _headers = create_shipping_estimate_with_http_info(_create_shipping_estimate_request, opts)
data
end

Expand Down Expand Up @@ -360,8 +365,9 @@ def create_shipping_estimate_with_http_info(create_shipping_estimate_request, op
# @param create_vehicle_estimate_request [CreateVehicleEstimateRequest]
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def create_vehicle_estimate(create_vehicle_estimate_request, opts = {})
data, _status_code, _headers = create_vehicle_estimate_with_http_info(create_vehicle_estimate_request, opts)
def create_vehicle_estimate(create_vehicle_estimate_request = {}, opts = {})
_create_vehicle_estimate_request = Patch::CreateVehicleEstimateRequest.new(create_vehicle_estimate_request)
data, _status_code, _headers = create_vehicle_estimate_with_http_info(_create_vehicle_estimate_request, opts)
data
end

Expand Down Expand Up @@ -426,6 +432,7 @@ def create_vehicle_estimate_with_http_info(create_vehicle_estimate_request, opts
# @param [Hash] opts the optional parameters
# @return [EstimateResponse]
def retrieve_estimate(id, opts = {})

data, _status_code, _headers = retrieve_estimate_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -489,6 +496,7 @@ def retrieve_estimate_with_http_info(id, opts = {})
# @option opts [Integer] :page
# @return [EstimateListResponse]
def retrieve_estimates(opts = {})

data, _status_code, _headers = retrieve_estimates_with_http_info(opts)
data
end
Expand Down
9 changes: 7 additions & 2 deletions lib/patch_ruby/api/orders_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def initialize(api_client = ApiClient.default)
# @param [Hash] opts the optional parameters
# @return [OrderResponse]
def cancel_order(id, opts = {})

data, _status_code, _headers = cancel_order_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -95,8 +96,9 @@ def cancel_order_with_http_info(id, opts = {})
# @param create_order_request [CreateOrderRequest]
# @param [Hash] opts the optional parameters
# @return [OrderResponse]
def create_order(create_order_request, opts = {})
data, _status_code, _headers = create_order_with_http_info(create_order_request, opts)
def create_order(create_order_request = {}, opts = {})
_create_order_request = Patch::CreateOrderRequest.new(create_order_request)
data, _status_code, _headers = create_order_with_http_info(_create_order_request, opts)
data
end

Expand Down Expand Up @@ -161,6 +163,7 @@ def create_order_with_http_info(create_order_request, opts = {})
# @param [Hash] opts the optional parameters
# @return [OrderResponse]
def place_order(id, opts = {})

data, _status_code, _headers = place_order_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -224,6 +227,7 @@ def place_order_with_http_info(id, opts = {})
# @param [Hash] opts the optional parameters
# @return [OrderResponse]
def retrieve_order(id, opts = {})

data, _status_code, _headers = retrieve_order_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -290,6 +294,7 @@ def retrieve_order_with_http_info(id, opts = {})
# @option opts [String] :metadata_example2
# @return [OrderListResponse]
def retrieve_orders(opts = {})

data, _status_code, _headers = retrieve_orders_with_http_info(opts)
data
end
Expand Down
8 changes: 6 additions & 2 deletions lib/patch_ruby/api/preferences_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def initialize(api_client = ApiClient.default)
# @param create_preference_request [CreatePreferenceRequest]
# @param [Hash] opts the optional parameters
# @return [PreferenceResponse]
def create_preference(create_preference_request, opts = {})
data, _status_code, _headers = create_preference_with_http_info(create_preference_request, opts)
def create_preference(create_preference_request = {}, opts = {})
_create_preference_request = Patch::CreatePreferenceRequest.new(create_preference_request)
data, _status_code, _headers = create_preference_with_http_info(_create_preference_request, opts)
data
end

Expand Down Expand Up @@ -97,6 +98,7 @@ def create_preference_with_http_info(create_preference_request, opts = {})
# @param [Hash] opts the optional parameters
# @return [PreferenceResponse]
def delete_preference(id, opts = {})

data, _status_code, _headers = delete_preference_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -160,6 +162,7 @@ def delete_preference_with_http_info(id, opts = {})
# @param [Hash] opts the optional parameters
# @return [PreferenceResponse]
def retrieve_preference(id, opts = {})

data, _status_code, _headers = retrieve_preference_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -223,6 +226,7 @@ def retrieve_preference_with_http_info(id, opts = {})
# @option opts [Integer] :page
# @return [PreferenceListResponse]
def retrieve_preferences(opts = {})

data, _status_code, _headers = retrieve_preferences_with_http_info(opts)
data
end
Expand Down
2 changes: 2 additions & 0 deletions lib/patch_ruby/api/projects_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def initialize(api_client = ApiClient.default)
# @param [Hash] opts the optional parameters
# @return [ProjectResponse]
def retrieve_project(id, opts = {})

data, _status_code, _headers = retrieve_project_with_http_info(id, opts)
data
end
Expand Down Expand Up @@ -96,6 +97,7 @@ def retrieve_project_with_http_info(id, opts = {})
# @option opts [Integer] :minimum_available_mass
# @return [ProjectListResponse]
def retrieve_projects(opts = {})

data, _status_code, _headers = retrieve_projects_with_http_info(opts)
data
end
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/1.11.0"
@user_agent = "patch-ruby/1.11.1"
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
Expand Down
2 changes: 1 addition & 1 deletion lib/patch_ruby/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
=end

module Patch
VERSION = '1.11.0'
VERSION = '1.11.1'
end

0 comments on commit 4dc0c0e

Please sign in to comment.