Sha256: caabba4ebf1c53b90d94373a46006d2e42f29dbfd11409f050864270b49a2cf3

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

####################################################################################################
# @author       David Kirwan <davidkirwanirl@gmail.com>
# @description  API class for the Ardtweeno system
#
# @date         08-01-2013
####################################################################################################

# Imports
require 'rubygems'
require 'logger'
require 'yaml'
require 'json'
require 'date'
require 'mongo'


module Ardtweeno

  ##
  # Ardtweeno::DB class to handle communication with a MongoDB Database
  #
  class DB
    class << self
    
      attr_accessor :log, :dbconnector, :auth, :coll
      
      ##
      # Ardtweeno::DB#new Constructor
      #
      # * *Args*    :
      #   - ++ -> newNode String, newKey String, options Hash{:description String, 
      # :version String, :sensors Array}
      # * *Returns* :
      #   -
      # * *Raises* :
      #
      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
      
    
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ardtweeno-0.5.0 lib/ardtweeno/db.rb
ardtweeno-0.4.0 lib/ardtweeno/db.rb
ardtweeno-0.3.1 lib/ardtweeno/db.rb
ardtweeno-0.3.0 lib/ardtweeno/db.rb
ardtweeno-0.2.5 lib/ardtweeno/db.rb