Class: MongoHQClient::Client
- Inherits:
-
Object
- Object
- MongoHQClient::Client
- Includes:
- HTTP
- Defined in:
- lib/mongohq-client/client.rb
Instance Attribute Summary collapse
-
#apikey ⇒ Object
Returns the value of attribute apikey.
Instance Method Summary collapse
- #create_database(db_name, plan) ⇒ Object
- #databases ⇒ Object
-
#initialize(apikey) ⇒ Client
constructor
A new instance of Client.
- #invoice(id) ⇒ Object
- #invoices ⇒ Object
- #plans ⇒ Object
Methods included from HTTP
Constructor Details
#initialize(apikey) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/mongohq-client/client.rb', line 8 def initialize(apikey) @apikey = apikey end |
Instance Attribute Details
#apikey ⇒ Object
Returns the value of attribute apikey.
6 7 8 |
# File 'lib/mongohq-client/client.rb', line 6 def apikey @apikey end |
Instance Method Details
#create_database(db_name, plan) ⇒ Object
24 25 26 27 28 |
# File 'lib/mongohq-client/client.rb', line 24 def create_database(db_name, plan) hash = { name: db_name, slug: plan } post("databases", hash) end |
#databases ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mongohq-client/client.rb', line 12 def databases json = get("databases") db_list = [] json.each do |db| db_list << Database.new(json: db, apikey: apikey) end db_list end |
#invoice(id) ⇒ Object
42 43 44 45 46 |
# File 'lib/mongohq-client/client.rb', line 42 def invoice(id) json = get("invoices/#{id}") Invoice.new json: json end |