Permalink
Browse files

Setup meter class with request_a and request_b

  • Loading branch information...
1 parent 4ca09bc commit a50d100bbf552372c1f4cb1cfc0c5d3a771e6565 @jwtd committed Apr 2, 2014
Showing with 574 additions and 0 deletions.
  1. +4 −0 Gemfile
  2. +58 −0 Gemfile.lock
  3. +5 −0 Rakefile
  4. +33 −0 ekm-omnimeter.gemspec
  5. +8 −0 lib/ekm-omnimeter.rb
  6. +25 −0 lib/ekm-omnimeter/logging.rb
  7. +359 −0 lib/ekm-omnimeter/meter.rb
  8. +14 −0 lib/ekm-omnimeter/version.rb
  9. +26 −0 spec/meter_spec.rb
  10. +42 −0 spec/spec_helper.rb
View
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in ekm-meter.gemspec
+gemspec
View
@@ -0,0 +1,58 @@
+PATH
+ remote: .
+ specs:
+ ekm-omnimeter (0.1.0)
+ bigdecimal
+ daemons
+ log4r (~> 1.1)
+ trollop
+ xively-rb-connector (~> 0.1)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ bigdecimal (1.2.5)
+ daemons (1.1.9)
+ diff-lcs (1.2.5)
+ httparty (0.13.0)
+ json (~> 1.8)
+ multi_xml (>= 0.5.2)
+ json (1.8.1)
+ log4r (1.1.10)
+ mini_portile (0.5.3)
+ multi_json (1.9.2)
+ multi_xml (0.5.5)
+ nokogiri (1.6.1)
+ mini_portile (~> 0.5.0)
+ ox (2.1.1)
+ rake (10.2.2)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.8)
+ rspec-expectations (2.14.5)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.6)
+ trollop (2.0)
+ xively-rb (0.2.10)
+ httparty (>= 0.10.0)
+ multi_json (>= 1.3.6)
+ multi_xml (>= 0.5.2)
+ nokogiri (>= 1.5.6)
+ ox (>= 1.5.9)
+ yajl-ruby (>= 1.1.0)
+ xively-rb-connector (0.1.1)
+ bigdecimal (~> 1.2)
+ log4r (~> 1.1)
+ xively-rb (~> 0.2)
+ yajl-ruby (1.2.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler (~> 1.3)
+ ekm-omnimeter!
+ rake (~> 10.2)
+ rspec
View
@@ -0,0 +1,5 @@
+require "bundler/gem_tasks"
+
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec)
+task :default => :spec
View
@@ -0,0 +1,33 @@
+# coding: utf-8
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'ekm-omnimeter/version'
+
+Gem::Specification.new do |spec|
+ spec.name = "ekm-omnimeter"
+ spec.version = EkmOmnimeter::VERSION::STRING
+ spec.authors = ["Jordan Duggan"]
+ spec.email = ["Jordan.Duggan@gmail.com"]
+ spec.description = %q{Ruby interface to the EKM Omnimeter Pulse}
+ spec.summary = %q{This ruby gem provides an interface to EKM Omnimeter Pulse meters that are connected to a EKM iSerial TCP/IP Ethernet to RS-485 Serial Converter. Omnimeter Pulse meters contain a revenue-grade universal kWh power meter, three pulse counting inputs for water and/or gas metering, and 2 controllable 50 mA at 12 volts relay outputs.}
+ spec.homepage = "https://github.com/jwtd/ekm-omnimeter"
+ spec.license = "MIT"
+
+ spec.files = `git ls-files`.split($/)
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
+ spec.require_paths = ["lib"]
+
+ # Development dependencies
+ spec.add_development_dependency "bundler", "~> 1.3"
+ spec.add_development_dependency "rake", "~> 10.2"
+ spec.add_development_dependency "rspec"
+
+ # Runtime dependencies
+ spec.add_runtime_dependency "log4r", "~> 1.1"
+ spec.add_runtime_dependency "xively-rb-connector", "~> 0.1"
+ spec.add_runtime_dependency "bigdecimal"
+ spec.add_runtime_dependency "trollop"
+ spec.add_runtime_dependency "daemons"
+
+end
@@ -0,0 +1,8 @@
+module EkmOmnimeter
+ # Base Ekm exception class
+ class EkmOmnimeterError < ::Exception; end
+end
+
+require "ekm-omnimeter/version"
+require "ekm-omnimeter/logging"
+require "ekm-omnimeter/meter"
@@ -0,0 +1,25 @@
+require 'log4r'
+include Log4r
+module EkmOmnimeter
+
+ module Logging
+
+ def logger
+ @logger ||= EkmOmnimeter::Logging.logger
+ end
+
+ def self.logger
+ @logger ||= self.configure_logger_for(self.class.name)
+ end
+
+ def self.configure_logger_for(classname)
+ l = Logger.new(classname)
+ l.level = ERROR
+ l.trace = false
+ l.add Log4r::Outputter.stderr
+ l
+ end
+
+ end
+
+end
Oops, something went wrong.

0 comments on commit a50d100

Please sign in to comment.