-
Notifications
You must be signed in to change notification settings - Fork 2
Fix the generator for optional body parameters #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| PATH | ||
| remote: . | ||
| specs: | ||
| patch_ruby (1.24.0) | ||
| patch_ruby (1.24.1) | ||
| typhoeus (~> 1.0, >= 1.0.1) | ||
|
|
||
| GEM | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ def create_air_shipping_estimate(create_air_shipping_estimate_request = {}, opts | |
| end | ||
|
|
||
| # Creates a GLEC air shipping estimate given freight mass and logistics | ||
| # Creates a GLEC air shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a GLEC air shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also fixed this escaping in the generator. |
||
| # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -116,7 +116,7 @@ def create_bitcoin_estimate(create_bitcoin_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create a bitcoin estimate given a timestamp and transaction value | ||
| # Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -185,7 +185,7 @@ def create_ethereum_estimate(create_ethereum_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create an ethereum estimate | ||
| # Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_ethereum_estimate_request [CreateEthereumEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -254,7 +254,7 @@ def create_flight_estimate(create_flight_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create a flight estimate given the distance traveled in meters | ||
| # Creates a flight estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a flight estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_flight_estimate_request [CreateFlightEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -323,7 +323,7 @@ def create_hotel_estimate(create_hotel_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create a hotel estimate. | ||
| # Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. | ||
| # Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. | ||
| # @param create_hotel_estimate_request [CreateHotelEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -392,7 +392,7 @@ def create_mass_estimate(create_mass_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create an estimate based on mass of CO2 | ||
| # Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. | ||
| # Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate. | ||
| # @param create_mass_estimate_request [CreateMassEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -461,7 +461,7 @@ def create_rail_shipping_estimate(create_rail_shipping_estimate_request = {}, op | |
| end | ||
|
|
||
| # Creates a GLEC rail shipping estimate given freight mass and logistics | ||
| # Creates a GLEC rail shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a GLEC rail shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -530,7 +530,7 @@ def create_road_shipping_estimate(create_road_shipping_estimate_request = {}, op | |
| end | ||
|
|
||
| # Creates a GLEC road shipping estimate given freight mass and logistics | ||
| # Creates a GLEC road shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a GLEC road shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -599,7 +599,7 @@ def create_sea_shipping_estimate(create_sea_shipping_estimate_request = {}, opts | |
| end | ||
|
|
||
| # Creates a GLEC sea shipping estimate given freight mass and logistics | ||
| # Creates a GLEC sea shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates a GLEC sea shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -668,7 +668,7 @@ def create_shipping_estimate(create_shipping_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create a shipping estimate given the distance traveled in meters, package weight, and transportation method. | ||
| # Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. | ||
| # Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters. | ||
| # @param create_shipping_estimate_request [CreateShippingEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
@@ -737,7 +737,7 @@ def create_vehicle_estimate(create_vehicle_estimate_request = {}, opts = {}) | |
| end | ||
|
|
||
| # Create a vehicle estimate given the distance traveled in meters and the type of vehicle | ||
| # Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate. | ||
| # @param create_vehicle_estimate_request [CreateVehicleEstimateRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,18 +28,19 @@ def initialize(api_client = ApiClient.default) | |
| @api_client = api_client | ||
| end | ||
| # Cancel an order | ||
| # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled. | ||
| # @param id [String] | ||
| # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled. | ||
| # @param id [String] | ||
| # @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 | ||
|
|
||
| # Cancel an order | ||
| # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled. | ||
| # @param id [String] | ||
| # Cancelling an order removes the associated offset allocation from an order. You will not be charged for cancelled orders. Only orders in the `draft` or `placed` state can be cancelled. | ||
| # @param id [String] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers | ||
| def cancel_order_with_http_info(id, opts = {}) | ||
|
|
@@ -91,19 +92,19 @@ def cancel_order_with_http_info(id, opts = {}) | |
| end | ||
|
|
||
| # Creates an order | ||
| # Creates an order in the `placed` or `draft` state. | ||
| # @param create_order_request [CreateOrderRequest] | ||
| # Creates an order in the `placed` or `draft` state. | ||
| # @param create_order_request [CreateOrderRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [OrderResponse] | ||
| def create_order(create_order_request = {}, opts = {}) | ||
| _create_order_request = Patch::CreateOrderRequest.new(create_order_request) | ||
| _create_order_request = Patch::CreateOrderRequest.new(create_order_request) | ||
| data, _status_code, _headers = create_order_with_http_info(_create_order_request, opts) | ||
| data | ||
| end | ||
|
|
||
| # Creates an order | ||
| # Creates an order in the `placed` or `draft` state. | ||
| # @param create_order_request [CreateOrderRequest] | ||
| # Creates an order in the `placed` or `draft` state. | ||
| # @param create_order_request [CreateOrderRequest] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers | ||
| def create_order_with_http_info(create_order_request, opts = {}) | ||
|
|
@@ -160,23 +161,22 @@ def create_order_with_http_info(create_order_request, opts = {}) | |
| end | ||
|
|
||
| # Place an order | ||
| # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed | ||
| # @param id [String] | ||
| # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed | ||
| # @param id [String] | ||
| # @param [Hash] opts the optional parameters | ||
| # @option opts [PlaceOrderRequest] :place_order_request | ||
| # @option opts [PlaceOrderRequest] :place_order_request | ||
| # @return [OrderResponse] | ||
| def place_order(order_id, opts = {}) | ||
| place_order_request = Patch::PlaceOrderRequest.new(opts) | ||
| opts[:place_order_request] = place_order_request | ||
| data, _status_code, _headers = place_order_with_http_info(order_id, opts) | ||
| def place_order(id, opts = {}) | ||
|
|
||
| data, _status_code, _headers = place_order_with_http_info(id, opts) | ||
| data | ||
| end | ||
|
Comment on lines
-168
to
173
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This version had (most likely) be written manually. The new one is entirely generated by the templates. |
||
|
|
||
| # Place an order | ||
| # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed | ||
| # @param id [String] | ||
| # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed | ||
| # @param id [String] | ||
| # @param [Hash] opts the optional parameters | ||
| # @option opts [PlaceOrderRequest] :place_order_request | ||
| # @option opts [PlaceOrderRequest] :place_order_request | ||
| # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers | ||
| def place_order_with_http_info(id, opts = {}) | ||
| if @api_client.config.debugging | ||
|
|
@@ -206,7 +206,7 @@ def place_order_with_http_info(id, opts = {}) | |
| form_params = opts[:form_params] || {} | ||
|
|
||
| # http body (model) | ||
| post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'place_order_request']) | ||
| post_body = opts[:debug_body] || @api_client.object_to_http_body(opts) | ||
|
|
||
| # return_type | ||
| return_type = opts[:debug_return_type] || 'OrderResponse' | ||
|
|
@@ -232,18 +232,19 @@ def place_order_with_http_info(id, opts = {}) | |
| end | ||
|
|
||
| # Retrieves an order | ||
| # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param id [String] | ||
| # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param id [String] | ||
| # @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 | ||
|
|
||
| # Retrieves an order | ||
| # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param id [String] | ||
| # Retrieves a given order and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param id [String] | ||
| # @param [Hash] opts the optional parameters | ||
| # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers | ||
| def retrieve_order_with_http_info(id, opts = {}) | ||
|
|
@@ -295,25 +296,26 @@ def retrieve_order_with_http_info(id, opts = {}) | |
| end | ||
|
|
||
| # Retrieves a list of orders | ||
| # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param [Hash] opts the optional parameters | ||
| # @option opts [Integer] :page | ||
| # @option opts [String] :metadata | ||
| # @option opts [String] :metadata_example1 | ||
| # @option opts [String] :metadata_example2 | ||
| # @option opts [Integer] :page | ||
| # @option opts [String] :metadata | ||
| # @option opts [String] :metadata_example1 | ||
| # @option opts [String] :metadata_example2 | ||
| # @return [OrderListResponse] | ||
| def retrieve_orders(opts = {}) | ||
|
|
||
| data, _status_code, _headers = retrieve_orders_with_http_info(opts) | ||
| data | ||
| end | ||
|
|
||
| # Retrieves a list of orders | ||
| # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # Retrieves a list of orders and its allocation offsets or negative emissions. You can only retrieve orders associated with the organization you are querying for. | ||
| # @param [Hash] opts the optional parameters | ||
| # @option opts [Integer] :page | ||
| # @option opts [String] :metadata | ||
| # @option opts [String] :metadata_example1 | ||
| # @option opts [String] :metadata_example2 | ||
| # @option opts [Integer] :page | ||
| # @option opts [String] :metadata | ||
| # @option opts [String] :metadata_example1 | ||
| # @option opts [String] :metadata_example2 | ||
| # @return [Array<(OrderListResponse, Integer, Hash)>] OrderListResponse data, response status code and response headers | ||
| def retrieve_orders_with_http_info(opts = {}) | ||
| if @api_client.config.debugging | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the bug in the template that was escaping those values.