Sha256: e5a43c4092ebb5801ac3c6795c071c8c5f03c05fc3e36f3300eebd862fc6c06d

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

module Whatser
  module Http
    include HTTParty
    
    def self.included(base)
      base_uri base.api_uri
    end
    
    def request(verb, path, params={}, options={})
      response = HTTParty.send( verb, compose_url(path), request_options( params ) )
      Whatser::Response.new( response.body, {:code => response.code}.merge(options) ) 
    end
    
  private

    def compose_url(path)
      "#{api_uri}#{path}"
    end

    def request_options(params={})
      params ||= {}
      return { :query => {:oauth_token => oauth_token}.merge(params[:query] || {}), 
               :body => params[:body] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whatser-0.2.0 lib/whatser/net/http.rb