Class: Exegesis::Server
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#create_database(name) ⇒ Object
creates a database with the given name on the server.
-
#databases ⇒ Object
returns an array of all the databases on the server.
-
#initialize(address = 'http://localhost:5984') ⇒ Server
constructor
Creates a new instance of Exegesis::Server.
- #inspect ⇒ Object
Methods included from Http
#delete, #escape_id, #format_url, #get, #post, #put
Constructor Details
#initialize(address = 'http://localhost:5984') ⇒ Server
Creates a new instance of Exegesis::Server. Defaults to localhost:5984 and verifies the existance of the database.
9 10 11 12 |
# File 'lib/exegesis/server.rb', line 9 def initialize address='http://localhost:5984' @uri = address @version = get(@uri)['version'] end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
5 6 7 |
# File 'lib/exegesis/server.rb', line 5 def uri @uri end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/exegesis/server.rb', line 5 def version @version end |
Instance Method Details
#create_database(name) ⇒ Object
creates a database with the given name on the server
20 21 22 |
# File 'lib/exegesis/server.rb', line 20 def create_database name put "#{@uri}/#{name}" end |
#databases ⇒ Object
returns an array of all the databases on the server
15 16 17 |
# File 'lib/exegesis/server.rb', line 15 def databases get "#{@uri}/_all_dbs" end |
#inspect ⇒ Object
24 25 26 |
# File 'lib/exegesis/server.rb', line 24 def inspect "#<Exegesis::Server:#{object_id} uri=#{@uri}>" end |