=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SwaggerClient class RefundsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create and apply refund # Creates and applies a refund per the specified parameters. On success the id of the refund is returned. # @param body refund request details json # @param [Hash] opts the optional parameters # @return [nil] def create_and_apply_refund(body, opts = {}) create_and_apply_refund_with_http_info(body, opts) nil end # Create and apply refund # Creates and applies a refund per the specified parameters. On success the id of the refund is returned. # @param body refund request details json # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def create_and_apply_refund_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RefundsApi.create_and_apply_refund ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RefundsApi.create_and_apply_refund" end # resource path local_var_path = '/refunds' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#create_and_apply_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get refund details # Get the details of the specified refund. # @param account_id id of the account # @param id id of the refund # @param [Hash] opts the optional parameters # @return [Refund] def get_refund_by_id(account_id, id, opts = {}) data, _status_code, _headers = get_refund_by_id_with_http_info(account_id, id, opts) data end # Get refund details # Get the details of the specified refund. # @param account_id id of the account # @param id id of the refund # @param [Hash] opts the optional parameters # @return [Array<(Refund, Fixnum, Hash)>] Refund data, response status code and response headers def get_refund_by_id_with_http_info(account_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RefundsApi.get_refund_by_id ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling RefundsApi.get_refund_by_id" end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RefundsApi.get_refund_by_id" end # resource path local_var_path = '/refunds/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'accountId'] = account_id # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Refund') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refund_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get refunds # Get all refunds for the specified account, OR if a credit memo number is specified in addition to the account id, get the details of only that. # @param account_id id of the account # @param [Hash] opts the optional parameters # @option opts [String] :credit_memo_number id of a credit memo # @return [Array] def get_refunds(account_id, opts = {}) data, _status_code, _headers = get_refunds_with_http_info(account_id, opts) data end # Get refunds # Get all refunds for the specified account, OR if a credit memo number is specified in addition to the account id, get the details of only that. # @param account_id id of the account # @param [Hash] opts the optional parameters # @option opts [String] :credit_memo_number id of a credit memo # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_refunds_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RefundsApi.get_refunds ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling RefundsApi.get_refunds" end # resource path local_var_path = '/refunds' # query parameters query_params = {} query_params[:'accountId'] = account_id query_params[:'creditMemoNumber'] = opts[:'credit_memo_number'] if !opts[:'credit_memo_number'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundsApi#get_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end