class Tire::HTTP::Client::Curb

Public Class Methods

delete(url) click to toggle source
# File lib/tire/http/clients/curb.rb, line 44
def self.delete(url)
  @client.url = url
  @client.http_delete
  Response.new @client.body_str, @client.response_code
end
get(url, data=nil) click to toggle source

@client.verbose = true

# File lib/tire/http/clients/curb.rb, line 15
def self.get(url, data=nil)
  @client.url = url

  # FIXME: Curb cannot post bodies with GET requests?
  #        Roy Fielding seems to approve:
  #        <http://tech.groups.yahoo.com/group/rest-discuss/message/9962>
  if data
    @client.post_body = data
    @client.http_post
  else
    @client.http_get
  end
  Response.new @client.body_str, @client.response_code
end
head(url) click to toggle source
# File lib/tire/http/clients/curb.rb, line 50
def self.head(url)
  @client.url = url
  @client.http_head
  Response.new @client.body_str, @client.response_code
end
post(url, data) click to toggle source
# File lib/tire/http/clients/curb.rb, line 30
def self.post(url, data)
  @client.url = url
  @client.post_body = data
  @client.http_post
  Response.new @client.body_str, @client.response_code
end
put(url, data) click to toggle source
# File lib/tire/http/clients/curb.rb, line 37
def self.put(url, data)
  @client.url = url
  @client.put_data = data
  @client.http_put
  Response.new @client.body_str, @client.response_code
end