Module: RestClientAdapter
Public Visibility
Public Class Method Summary
convert_exception(&blk) | |
---|---|
copy(uri, headers) | |
delete(uri, headers = {}) | |
get(uri, headers = {}) | |
post(uri, hash, headers = {}) | |
put(uri, hash, headers = {}) |
Public Class Method Details
convert_exception
public
convert_exception(&blk)
[View source]
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 4 def self.convert_exception(&blk) begin yield rescue Exception => e ending = e.class.to_s.match(/[a-z0-9_]*\z/i) if e..match(/409\z/) raise Aqua::Store::CouchDB::Conflict, e. else begin error = "Aqua::Store::CouchDB::#{ending}".constantize rescue raise e end raise error, e. end end end |
copy
public
copy(uri, headers)
[View source]
46 47 48 49 50 51 52 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 46 def self.copy(uri, headers) convert_exception do RestClient::Request.execute( :method => :copy, :url => uri, :headers => headers) end end |
delete
public
delete(uri, headers = {})
[View source]
40 41 42 43 44 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 40 def self.delete(uri, headers={}) convert_exception do RestClient.delete(uri, headers) end end |
get
public
get(uri, headers = {})
[View source]
22 23 24 25 26 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 22 def self.get(uri, headers={}) convert_exception do RestClient.get(uri, headers) end end |
post
public
post(uri, hash, headers = {})
[View source]
28 29 30 31 32 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 28 def self.post(uri, hash, headers={}) convert_exception do RestClient.post(uri, hash, headers) end end |
put
public
put(uri, hash, headers = {})
[View source]
34 35 36 37 38 |
# File 'lib/aqua/store/couch_db/http_client/adapter/rest_client.rb', line 34 def self.put(uri, hash, headers={}) convert_exception do RestClient.put(uri, hash, headers) end end |