Sha256: 6c9f89cc70e81dacb5152b347aee4ef1fc7291790b7afb47f07744bdcc83d08d

Contents?: true

Size: 607 Bytes

Versions: 2

Compression:

Stored size: 607 Bytes

Contents

module Smoodit
  # 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
      
      return raw ? response : response.body, response.status
    end
    
    private

    def formatted_path(path)
      path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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