Sha256: 25a20c32f9b39267b23bbf89f8bb38d35edb121519d7d6a1088381221da62294

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

require 'json'

module Tumblr
  module Request

    #Performs a get request
    def get(path, params={})
      response = connection.get do |req|
        req.url path 
        req.params = params
      end
      #check for errors and encapsulate
      response.body['response']
    end
    
    #Performs post request
    def post(path, params={})
      response = connection.post do |req|
        req.url path
        req.body = params unless params.empty?
      end
      #Check for errors and encapsulate
      response.body['response']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tumblr_client-0.6.7 lib/tumblr/request.rb
tumblr_client-0.6.6 lib/tumblr/request.rb
tumblr_client-0.6.5 lib/tumblr/request.rb