Class: Sputnik::Database
- Defined in:
- lib/sputnik/database.rb
Class Method Summary collapse
- .all ⇒ Object
- .create(params) ⇒ Object
- .delete(database_name) ⇒ Object
- .find(database_name) ⇒ Object
Instance Method Summary collapse
-
#collection ⇒ Object
Sputnik::Database.new(:name => ‘derp’).collection.all.
- #stats ⇒ Object
Methods inherited from Base
Class Method Details
.all ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/sputnik/database.rb', line 6 def all response = client.get('/databases') values = [] response.each do |item| values << Database.new(item) end values end |
.create(params) ⇒ Object
19 20 21 |
# File 'lib/sputnik/database.rb', line 19 def create(params) Database.new(client.post('/databases', params)) end |
.delete(database_name) ⇒ Object
23 24 25 |
# File 'lib/sputnik/database.rb', line 23 def delete(database_name) client.delete("/databases/#{database_name}", params) end |
.find(database_name) ⇒ Object
15 16 17 |
# File 'lib/sputnik/database.rb', line 15 def find(database_name) Database.new(client.get("/databases/#{database_name}")) end |
Instance Method Details
#collection ⇒ Object
Sputnik::Database.new(:name => ‘derp’).collection.all
29 30 31 |
# File 'lib/sputnik/database.rb', line 29 def collection Collection.new(:database => self) end |
#stats ⇒ Object
33 34 35 |
# File 'lib/sputnik/database.rb', line 33 def stats DatabaseStats.find(db) end |