Class: Sputnik::Database

Inherits:
Base
  • Object
show all
Defined in:
lib/sputnik/database.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client

Class Method Details

.allObject



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

#collectionObject

Sputnik::Database.new(:name => ‘derp’).collection.all



29
30
31
# File 'lib/sputnik/database.rb', line 29

def collection
  Collection.new(:database => self)
end

#statsObject



33
34
35
# File 'lib/sputnik/database.rb', line 33

def stats
  DatabaseStats.find(db)
end