def send_request(request)
      begin
        uri = URI "#{request.gateway_url}/#{request.api_method}/#{request.end_point}"

        response = HTTP.start uri.hostname, uri.port, :use_ssl => uri.scheme == 'https' do |http|
          post = HTTP::Post.new uri.request_uri
          post.set_form_data request.request_fields
          http.request post
        end
      rescue Exception => e
        raise RequestError, "Error occurred. #{e.message}"
      end

      unless HTTPOK === response
        raise RequestError, "Error occurred. HTTP code: '#{response.code}'. Server message: '#{response.message}'"
      end

      response
    end
def send_request(request)
      begin
        uri = URI "#{request.gateway_url}/#{request.api_method}/#{request.end_point}"

        response = HTTP.start uri.hostname, uri.port, :use_ssl => uri.scheme == 'https' do |http|
          post = HTTP::Post.new uri.request_uri
          post.set_form_data request.request_fields
          http.request post
        end
      rescue Exception => e
        raise RequestError, "Error occurred. #{e.message}"
      end

      unless HTTPOK === response
        raise RequestError, "Error occurred. HTTP code: '#{response.code}'. Server message: '#{response.message}'"
      end

      response
    end
Executes request

 @param    request   [Request]         Request to execute

 @return             [HTTPResponse]    PaynetEasy response as HTTPResponse