Module: RestAPI

HTTP Adapters should implement the following to be used with the RestAPI module

def self.get(uri, headers=nil) end

def self.post(uri, hash, headers=nil) end

def self.put(uri, hash, headers=nil) end

def self.delete(uri, headers=nil) end

def self.copy(uri, headers) end

Public Visibility

Public Class Method Summary

adapter
adapter=(klass)

Public Instance Method Summary

#copy(uri, destination)
#delete(uri)
#get(uri)
#post(uri, doc = nil)
#put(uri, doc = nil)

Public Class Method Details

adapter

public adapter
[View source]


23
24
25
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 23

def self.adapter
  @adapter
end

adapter=

public adapter=(klass)
[View source]


19
20
21
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 19

def self.adapter=( klass )
  @adapter = klass
end

Public Instance Method Details

copy

public copy(uri, destination)
[View source]


49
50
51
52
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 49

def copy(uri, destination)
  response = RestAPI.adapter.copy(uri, {'Destination' => destination}) 
  JSON.parse( response )
end

delete

public delete(uri)
[View source]


44
45
46
47
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 44

def delete(uri) 
  response = RestAPI.adapter.delete(uri)
  JSON.parse( response )
end

get

public get(uri)
[View source]


33
34
35
36
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 33

def get(uri) 
  response = RestAPI.adapter.get(uri)
  JSON.parse( response , :max_nesting => false)
end

post

public post(uri, doc = nil)
[View source]


38
39
40
41
42
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 38

def post(uri, doc = nil)
  hash = doc.to_json if doc 
  response = RestAPI.adapter.post(uri, hash)
  JSON.parse( response )
end

put

public put(uri, doc = nil)
[View source]


27
28
29
30
31
# File 'lib/aqua/store/couch_db/http_client/rest_api.rb', line 27

def put(uri, doc = nil)
  hash = doc.to_json if doc
  response = RestAPI.adapter.put( uri, hash )
  JSON.parse( response )
end
Generated on Friday, August 21 2009 at 12:48:48 PM by YARD 0.2.3.5 (ruby-1.8.6).