parse_p1 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  *.gem
2
- .rvmrc
3
2
  .bundle
4
3
  Gemfile.lock
5
4
  pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@parse_p1 --create
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * 0.0.6
2
+ Added so called direct methods electra_import_normal, electra_import_low, electra_export_normal and electra_export_low
3
+
1
4
  * 0.0.5
2
5
  Bug fix: normal and low tariffs for electricity were changed!
3
6
 
@@ -11,5 +14,4 @@
11
14
  Parsing of electricity and gas values
12
15
 
13
16
  * 0.0.1
14
-
15
17
  Initial release
data/README.md CHANGED
@@ -37,10 +37,16 @@ Usage
37
37
  =====
38
38
 
39
39
  <pre>
40
- p1 = ParseP1::Base.new(p1_string)
40
+ p1 = ParseP1::Base.new(p1_string)
41
+
41
42
  p1.electra_meter_id #-> 1A123456789012345678901234567890
42
43
  p1.electricity(:type => :import, :tariff => :normal) #-> 116.34 (kWH)
43
44
  p1.electricity(:type => :import, :actual => :true) #-> 1245 (watt)
45
+
46
+ or with the direct methods: electra_import_normal, electra_import_low, electra_export_normal and electra_export_low
47
+
48
+ and for gas:
49
+
44
50
  p1.gas_usage #-> 91.224 (m3)
45
51
  </pre>
46
52
 
@@ -15,6 +15,26 @@ module ParseP1
15
15
  electricity('0-0:17.0.0')
16
16
  end
17
17
 
18
+ def electra_import_low
19
+ electricity(:type => :import, :tariff => :low)
20
+ end
21
+
22
+ def electra_import_normal
23
+ electricity(:type => :import, :tariff => :normal)
24
+ end
25
+
26
+ def electra_export_low
27
+ electricity(:type => :export, :tariff => :low)
28
+ end
29
+
30
+ def electra_export_normal
31
+ electricity(:type => :export, :tariff => :normal)
32
+ end
33
+
34
+ def actual_electra
35
+ electricity(:type => :import, :actual => true)
36
+ end
37
+
18
38
  def electricity(options)
19
39
  if options.is_a?(Hash)
20
40
  if options[:actual] == true
@@ -1,3 +1,3 @@
1
1
  module ParseP1
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -52,23 +52,27 @@ class TestParseP1 < Test::Unit::TestCase
52
52
  end
53
53
 
54
54
  #F9 (3,3)
55
- should 'return imported electricty with normal tarif' do
55
+ should 'return imported electricty with low tarif' do
56
56
  assert_equal 136.787, @p1.electricity(:type => :import, :tariff => :low)
57
+ assert_equal 136.787, @p1.electra_import_low
57
58
  end
58
59
 
59
60
  #F9 (3,3)
60
- should 'return imported electricty with low tarif' do
61
+ should 'return imported electricty with normal tarif' do
61
62
  assert_equal 131.849, @p1.electricity(:type => :import, :tariff => :normal)
63
+ assert_equal 131.849, @p1.electra_import_normal
62
64
  end
63
65
 
64
66
  #F9 (3,3)
65
- should 'return electricty produced by client normal tarif' do
67
+ should 'return electricty produced by client low tarif' do
66
68
  assert_equal 2.345, @p1.electricity(:type => :export, :tariff => :low)
69
+ assert_equal 2.345, @p1.electra_export_low
67
70
  end
68
71
 
69
72
  #F9 (3,3)
70
- should 'return electricty produced by client low tarif' do
73
+ should 'return electricty produced by client normal tarif' do
71
74
  assert_equal 54.976, @p1.electricity(:type => :export, :tariff => :normal)
75
+ assert_equal 54.976, @p1.electra_export_normal
72
76
  end
73
77
 
74
78
  context 'Actual data' do
@@ -76,6 +80,7 @@ class TestParseP1 < Test::Unit::TestCase
76
80
  #F5 (3,3)
77
81
  should 'return actual power imported' do
78
82
  assert_equal 3200, @p1.electricity(:type => :import, :actual => true)
83
+ assert_equal 3200, @p1.actual_electra
79
84
  end
80
85
 
81
86
  #F5 (3,3)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse_p1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-29 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
@@ -71,6 +71,7 @@ extra_rdoc_files:
71
71
  - README.md
72
72
  files:
73
73
  - .gitignore
74
+ - .rvmrc
74
75
  - .travis.yml
75
76
  - CHANGELOG
76
77
  - Gemfile
@@ -105,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  segments:
107
108
  - 0
108
- hash: 1908051008069014212
109
+ hash: 2211038779225675190
109
110
  required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  none: false
111
112
  requirements:
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
115
  version: '0'
115
116
  segments:
116
117
  - 0
117
- hash: 1908051008069014212
118
+ hash: 2211038779225675190
118
119
  requirements: []
119
120
  rubyforge_project: parse_p1
120
121
  rubygems_version: 1.8.24