2009-07-14 10:43:40 +02:00
|
|
|
module RestClientAdapter
|
|
|
|
|
|
|
|
module API
|
|
|
|
def proxy=(url)
|
|
|
|
RestClient.proxy = url
|
|
|
|
end
|
|
|
|
|
|
|
|
def proxy
|
|
|
|
RestClient.proxy
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri, headers={})
|
2010-02-20 18:45:53 +01:00
|
|
|
RestClient.get(uri, headers).to_s
|
2009-07-14 10:43:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def post(uri, payload, headers={})
|
2010-02-20 18:45:53 +01:00
|
|
|
RestClient.post(uri, payload, headers).to_s
|
2009-07-14 10:43:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def put(uri, payload, headers={})
|
2010-02-20 18:45:53 +01:00
|
|
|
RestClient.put(uri, payload, headers).to_s
|
2009-07-14 10:43:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def delete(uri, headers={})
|
2010-02-20 18:45:53 +01:00
|
|
|
RestClient.delete(uri, headers).to_s
|
2009-07-14 10:43:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def copy(uri, headers)
|
|
|
|
RestClient::Request.execute( :method => :copy,
|
|
|
|
:url => uri,
|
2010-02-20 18:45:53 +01:00
|
|
|
:headers => headers).to_s
|
2009-07-14 10:43:40 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|