Sha256: 87986fa472e8bba8d2a3a99976946e28b6909feb4bc1a81b7023c0662f3bb7d6

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

module MongoHQClient

  class Client
    include HTTP

    attr_accessor :apikey

    def initialize(apikey)
      @apikey = apikey
    end

    def databases
      json = get("databases")

      db_list = []

      json.each do |db|
        db_list << Database.new(json: db, apikey: apikey)
      end

      db_list
    end

    def invoices
      json = get("invoices")

      invoices = []

      json.each do |invoice|
        invoices << Invoice.new(json: invoice)
      end

      invoices
    end

    def invoice(id)
      json = get("invoices/#{id}")

      Invoice.new json: json
    end

    def plans
      json = get("plans")

      plans = []

      json.each do |plan|
        plans << Plan.new(json: plan)
      end

      plans
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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