def request(request_name, options={}, &params)
      if options[:api_version].nil? && @default_options[:api_version]
        options[:api_version] = @default_options[:api_version]
      end

      session_data = options[:session_data] || default_session_data

      raise SessionDataNotProvidedError.new(@service, request_name) unless session_data

      [:base_url].each do |k|
        session_data[k] = options[k] if options[k]
      end

      request_class = provider_module.find_request(service, request_name, session_data, options)

      raise UnknownRequestError.new(request_name, options) unless request_class

      # Always use :params over &params if provided
      if options[:params]
        params = lambda do |params|
          options[:params].each do |key, value|
            begin
              params[key] = value
            rescue NameError => e
              raise NameError.new("Unknown param name '#{key}'")
            end
          end
        end
      end

      request  = request_class.new(session_data, &params)

      response = http_connection.send(request.http_method) do |r|
        r.url        request.url
        r.headers.merge!(request.headers)        if request.headers?
        r.query    = request.querystring         if request.querystring?
        r.body     = JSON.generate(request.body) if request.body?
      end

      Aviator::Response.send(:new, response, request)
    end
def request(request_name, options={}, &params)
      if options[:api_version].nil? && @default_options[:api_version]
        options[:api_version] = @default_options[:api_version]
      end

      session_data = options[:session_data] || default_session_data

      raise SessionDataNotProvidedError.new(@service, request_name) unless session_data

      [:base_url].each do |k|
        session_data[k] = options[k] if options[k]
      end

      request_class = provider_module.find_request(service, request_name, session_data, options)

      raise UnknownRequestError.new(request_name, options) unless request_class

      # Always use :params over &params if provided
      if options[:params]
        params = lambda do |params|
          options[:params].each do |key, value|
            begin
              params[key] = value
            rescue NameError => e
              raise NameError.new("Unknown param name '#{key}'")
            end
          end
        end
      end

      request  = request_class.new(session_data, &params)

      response = http_connection.send(request.http_method) do |r|
        r.url        request.url
        r.headers.merge!(request.headers)        if request.headers?
        r.query    = request.querystring         if request.querystring?
        r.body     = JSON.generate(request.body) if request.body?
      end

      Aviator::Response.send(:new, response, request)
    end
No longer recommended for public use. Use Aviator::Session#request instead