Module: Tumblr::Request

Included in:
Client
Defined in:
lib/tumblr/request.rb,
lib/tumblr/request/oauth.rb

Defined Under Namespace

Classes: TumblrOAuth

Instance Method Summary collapse

Instance Method Details

#get(path, params = {}) ⇒ Object

Performs a get request



7
8
9
10
11
12
13
14
# File 'lib/tumblr/request.rb', line 7

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

#post(path, params = {}) ⇒ Object

Performs post request



17
18
19
20
21
22
23
24
# File 'lib/tumblr/request.rb', line 17

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