Module: Sputnik

Defined in:
lib/sputnik/database.rb,
lib/sputnik.rb,
lib/sputnik/base.rb,
lib/sputnik/plan.rb,
lib/sputnik/index.rb,
lib/sputnik/version.rb,
lib/sputnik/document.rb,
lib/sputnik/collection.rb,
lib/sputnik/connection.rb,
lib/sputnik/database_stats.rb

Overview

TODO: use command pattern to build an enumerable command that’s not called until it’s used

Defined Under Namespace

Classes: Base, Collection, Connection, Database, DatabaseStats, Document, Index, Plan

Constant Summary collapse

ConnectionNotAuthenticatedError =
Class.new(RuntimeError)
VERSION =
"0.2"
DEFAULT_HOST =
'https://api.mongohq.com'

Class Method Summary collapse

Class Method Details

.authenticate(options = {}) ⇒ Object



11
12
13
# File 'lib/sputnik.rb', line 11

def authenticate(options={})
  Sputnik.client = Sputnik::Connection.new(options)
end

.clientObject



15
16
17
# File 'lib/sputnik.rb', line 15

def client
  Thread.current[:sputnik_client] || (raise ConnectionNotAuthenticatedError, 'You must first call the authenticate method to connect to MongoHQ.')
end

.client=(new_client) ⇒ Object



19
20
21
# File 'lib/sputnik.rb', line 19

def client=(new_client)
  Thread.current[:sputnik_client] = new_client
end