VimUnDo°iȴ|K;u/`I`Aexi)Z8Ya__a^Y=begin #Patch API V14#The core API used to integrate with Patch's service'The version of the OpenAPI document: v1 Contact: developers@usepatch.com,Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1=end require 'cgi' module Patch class OrdersApi OPERATIONS = [ :cancel_order, :create_order, :place_order, :retrieve_order, :retrieve_orders, ] attr_accessor :api_client2 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] 0 # @param [Hash] opts the optional parameters # @return [OrderResponse]# def cancel_order(id, opts = {})J 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] 0 # @param [Hash] opts the optional parameterss # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers2 def cancel_order_with_http_info(id, opts = {})% if @api_client.config.debuggingQ @api_client.config.logger.debug 'Calling API: OrdersApi.cancel_order ...' end1 # verify the required parameter 'id' is set= if @api_client.config.client_side_validation && id.nil?e fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.cancel_order" end # resource pathZ local_var_path = '/v1/orders/{id}/cancel'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters. query_params = opts[:query_params] || {} # header parameters0 header_params = opts[:header_params] || {}( # HTTP header 'Accept' (if needed)V header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters, form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body]  # return_type: return_type = opts[:return_type] || 'OrderResponse'  # auth_names7 auth_names = opts[:auth_names] || ['bearer_auth'] new_options = opts.merge(( :header_params => header_params,& :query_params => query_params,$ :form_params => form_params, :body => post_body," :auth_names => auth_names,# :return_type => return_type )\ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)% if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#cancel_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end' return data, status_code, headers end # Creates an orderc # Creates an order in the `placed` state. To create a `draft` order, create an estimate first. 7 # @param create_order_request [CreateOrderRequest] 0 # @param [Hash] opts the optional parameters # @return [OrderResponse]5 def create_order(create_order_request, opts = {})\ data, _status_code, _headers = create_order_with_http_info(create_order_request, opts) data end # Creates an orderw # Creates an order in the `placed` state. To create a `draft` order, create an estimate first. 7 # @param create_order_request [CreateOrderRequest] 0 # @param [Hash] opts the optional parameterss # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headersD def create_order_with_http_info(create_order_request, opts = {})% if @api_client.config.debuggingQ @api_client.config.logger.debug 'Calling API: OrdersApi.create_order ...' endC # verify the required parameter 'create_order_request' is setO if @api_client.config.client_side_validation && create_order_request.nil?w fail ArgumentError, "Missing the required parameter 'create_order_request' when calling OrdersApi.create_order" end # resource path# local_var_path = '/v1/orders' # query parameters. query_params = opts[:query_params] || {} # header parameters0 header_params = opts[:header_params] || {}( # HTTP header 'Accept' (if needed)V header_params['Accept'] = @api_client.select_header_accept(['application/json'])" # HTTP header 'Content-Type'b header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters, form_params = opts[:form_params] || {} # http body (model)W post_body = opts[:body] || @api_client.object_to_http_body(create_order_request)  # return_type: return_type = opts[:return_type] || 'OrderResponse'  # auth_names7 auth_names = opts[:auth_names] || ['bearer_auth'] new_options = opts.merge(( :header_params => header_params,& :query_params => query_params,$ :form_params => form_params, :body => post_body," :auth_names => auth_names,# :return_type => return_type )[ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)% if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end' return data, status_code, headers end # Place an orderz # Placing an order confirms an order's allocation of offsets. Only orders that are in the `draft` state can be placed  # @param id [String] 0 # @param [Hash] opts the optional parameters # @return [OrderResponse]" def place_order(id, opts = {})I data, _status_code, _headers = place_order_with_http_info(id, opts) data 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] 0 # @param [Hash] opts the optional parameterss # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers1 def place_order_with_http_info(id, opts = {})% if @api_client.config.debuggingP @api_client.config.logger.debug 'Calling API: OrdersApi.place_order ...' end1 # verify the required parameter 'id' is set= if @api_client.config.client_side_validation && id.nil?d fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.place_order" end # resource pathY local_var_path = '/v1/orders/{id}/place'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters. query_params = opts[:query_params] || {} # header parameters0 header_params = opts[:header_params] || {}( # HTTP header 'Accept' (if needed)V header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters, form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body]  # return_type: return_type = opts[:return_type] || 'OrderResponse'  # auth_names7 auth_names = opts[:auth_names] || ['bearer_auth'] new_options = opts.merge(( :header_params => header_params,& :query_params => query_params,$ :form_params => form_params, :body => post_body," :auth_names => auth_names,# :return_type => return_type )\ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)% if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end' return data, status_code, headers 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] 0 # @param [Hash] opts the optional parameters # @return [OrderResponse]% def retrieve_order(id, opts = {})L 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] 0 # @param [Hash] opts the optional parameterss # @return [Array<(OrderResponse, Integer, Hash)>] OrderResponse data, response status code and response headers4 def retrieve_order_with_http_info(id, opts = {})% if @api_client.config.debuggingS @api_client.config.logger.debug 'Calling API: OrdersApi.retrieve_order ...' end1 # verify the required parameter 'id' is set= if @api_client.config.client_side_validation && id.nil?g fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.retrieve_order" end # resource pathS local_var_path = '/v1/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters. query_params = opts[:query_params] || {} # header parameters0 header_params = opts[:header_params] || {}( # HTTP header 'Accept' (if needed)V header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters, form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body]  # return_type: return_type = opts[:return_type] || 'OrderResponse'  # auth_names7 auth_names = opts[:auth_names] || ['bearer_auth'] new_options = opts.merge(( :header_params => header_params,& :query_params => query_params,$ :form_params => form_params, :body => post_body," :auth_names => auth_names,# :return_type => return_type )Z data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)% if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#retrieve_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end' return data, status_code, headers 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. 0 # @param [Hash] opts the optional parameters# # @option opts [Integer] :page - # @option opts [String] :metadata_ext_id 2 # @option opts [String] :metadata_disregarded ! # @return [OrderListResponse]" def retrieve_orders(opts = {})I 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. 0 # @param [Hash] opts the optional parameters# # @option opts [Integer] :page - # @option opts [String] :metadata_ext_id 2 # @option opts [String] :metadata_disregarded { # @return [Array<(OrderListResponse, Integer, Hash)>] OrderListResponse data, response status code and response headers1 def retrieve_orders_with_http_info(opts = {})% if @api_client.config.debuggingT @api_client.config.logger.debug 'Calling API: OrdersApi.retrieve_orders ...' end # resource path# local_var_path = '/v1/orders' # query parameters. query_params = opts[:query_params] || {}B query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?d query_params[:'metadata[ext_id]'] = opts[:'metadata_ext_id'] if !opts[:'metadata_ext_id'].nil?s query_params[:'metadata[disregarded]'] = opts[:'metadata_disregarded'] if !opts[:'metadata_disregarded'].nil? # header parameters0 header_params = opts[:header_params] || {}( # HTTP header 'Accept' (if needed)V header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters, form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body]  # return_type> return_type = opts[:return_type] || 'OrderListResponse'  # auth_names7 auth_names = opts[:auth_names] || ['bearer_auth'] new_options = opts.merge(( :header_params => header_params,& :query_params => query_params,$ :form_params => form_params, :body => post_body," :auth_names => auth_names,# :return_type => return_type )Z data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)% if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#retrieve_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end' return data, status_code, headers end endend5