Class: Tire::HTTP::Client::Curb

Inherits:
Object
  • Object
show all
Defined in:
lib/tire/http/clients/curb.rb

Class Method Summary collapse

Class Method Details

.delete(url) ⇒ Object



43
44
45
46
47
# File 'lib/tire/http/clients/curb.rb', line 43

def self.delete(url)
  @client.url = url
  @client.http_delete
  Response.new @client.body_str, @client.response_code
end

.get(url, data = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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) ⇒ Object



49
50
51
52
53
# File 'lib/tire/http/clients/curb.rb', line 49

def self.head(url)
  @client.url = url
  @client.http_head
  Response.new @client.body_str, @client.response_code
end

.post(url, data) ⇒ Object



30
31
32
33
34
35
# 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) ⇒ Object



37
38
39
40
41
# File 'lib/tire/http/clients/curb.rb', line 37

def self.put(url, data)
  @client.url = url
  @client.http_put data
  Response.new @client.body_str, @client.response_code
end