Sha256: af7847369cb2c44f6ddeef06a67c61a8248828ef11158e133c992d505be97415

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 Bytes

Contents

module MongoHQClient

  class Database
    include Commons
    include HTTP

    def details
      json = get("databases/#{name}")

      DatabaseDetails.new json: json
    end

    def collections
      json = get("databases/#{name}/collections")

      collections = []

      json.each do |col|
        collections << Collection.new(json: col, apikey: apikey, database: name)
      end

      collections
    end

    def collection(col_name)
      json = get("databases/#{name}/collections/#{col_name}")

      Collection.new(json: json, database: name)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongohq-client-0.0.3 lib/mongohq-client/database.rb
mongohq-client-0.0.2 lib/mongohq-client/database.rb