Sha256: 7b5adb2050ee51b9a7f8152b0a63427a6f62c465edf0adb52a6d0fbaad462eb8

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

module Thounds
  # Defines HTTP request methods
  module Request
    # Perform an HTTP request
    def request(method, path, options={}, raw=false)
      response = connection(raw).send(method) do |request|
        case method
        when :get, :delete
          request.url(formatted_path(path), options)
        when :post, :put
          request.path = formatted_path(path)
          request.body = options unless options.empty?
        end
      end
      raw ? response : response.body
    end
    
    private

    def formatted_path(path)
      path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thounds-0.0.2 lib/thounds/request.rb
thounds-0.0.1 lib/thounds/request.rb