Sha256: 1fc2650aed5fa8ae5d72b417a9bda87104725e3f213bcac5e86cd8f47503902b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module XivelyConnector

  # Base XivelyConnector exception class
  class XivelyConnectorError < ::Exception; end

  # Module level methods for establishing connections and finding objects
  @@connection = nil

  # Lookup methods delegate to class methods
  def self.connection
    @@connection
  end

  # Lookup methods delegate to class methods
  def self.connect(options)
    raise "A connection can not be established without an :api_key" unless options[:api_key]
    @@connection = Connection.new(options)
  end

  # Lookup methods delegate to class methods
  def self.connected?
    not @@connection.nil?
  end

  # Releases the connection
  def self.disconnect()
    @@connection = nil
  end

  # Lookup method delegates to class methods
  def self.find(id, api_key=nil)
    self.find_device_by_id(id, api_key=nil)
  end

  # Lookup methods delegate to class methods
  def self.find_device_by_id(id, options)
    Device.find_by_id(id, options)
  end

end

require "xively-rb-connector/version"
require "xively-rb-connector/logger"
require "xively-rb-connector/connection"
require "xively-rb-connector/device"
require "xively-rb-connector/datastream"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xively-rb-connector-0.1.4 lib/xively-rb-connector.rb