Class: MongoHQClient::Database
- Inherits:
-
Object
- Object
- MongoHQClient::Database
show all
- Includes:
- Commons, HTTP
- Defined in:
- lib/mongohq-client/database.rb
Instance Method Summary
collapse
Methods included from HTTP
#delete, #get, #post
Methods included from Commons
#initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class MongoHQClient::Commons
Instance Method Details
#collection(col_name) ⇒ Object
25
26
27
28
29
|
# File 'lib/mongohq-client/database.rb', line 25
def collection(col_name)
json = get("databases/#{name}/collections/#{col_name}")
Collection.new(json: json, database: name)
end
|
#collections ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mongohq-client/database.rb', line 13
def collections
json = get("databases/#{name}/collections")
collections = []
json.each do |col|
collections << Collection.new(json: col, apikey: apikey, database: name)
end
collections
end
|
#details ⇒ Object
7
8
9
10
11
|
# File 'lib/mongohq-client/database.rb', line 7
def details
json = get("databases/#{name}")
DatabaseDetails.new json: json
end
|
#remove ⇒ Object
31
32
33
|
# File 'lib/mongohq-client/database.rb', line 31
def remove
delete("databases/#{name}")
end
|