Class: Ardtweeno::DB

Inherits:
Object
  • Object
show all
Defined in:
lib/ardtweeno/db.rb

Overview

Ardtweeno::DB class to handle communication with a MongoDB Database

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.authObject

Returns the value of attribute auth.



42
43
44
# File 'lib/ardtweeno/db.rb', line 42

def auth
  @auth
end

.collObject

Returns the value of attribute coll.



42
43
44
# File 'lib/ardtweeno/db.rb', line 42

def coll
  @coll
end

.dbconnectorObject

Returns the value of attribute dbconnector.



42
43
44
# File 'lib/ardtweeno/db.rb', line 42

def dbconnector
  @dbconnector
end

.logObject

Returns the value of attribute log.



42
43
44
# File 'lib/ardtweeno/db.rb', line 42

def log
  @log
end

Class Method Details

.initializeObject

Ardtweeno::DB#new Constructor

  • Args :

    • ++ -> newNode String, newKey String, options HashString,

:version String, :sensors Array

  • Returns : -

  • Raises :



54
55
56
57
58
59
60
61
62
63
# File 'lib/ardtweeno/db.rb', line 54

def initialize
  @log = Ardtweeno.options[:log] ||= Logger.new(STDOUT)
  @log.level = Ardtweeno.options[:level] ||= Logger::DEBUG
  
  @dbconnector = Mongo::Connection.new(host, port).db(databaseName)
  @auth = @dbconnector.authenticate(my_user_name, my_password)
  @coll = @dbconnector.collection(collName)
  
  
end