flukso4r 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of flukso4r might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/lib/flukso/api.rb +8 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/flukso/api.rb
CHANGED
@@ -45,7 +45,7 @@ module Flukso
|
|
45
45
|
# The response is an array of arrays. Convert it to UTCReadings.
|
46
46
|
retval=Array.new();
|
47
47
|
response.each{|reading|
|
48
|
-
current=UTCReading.new(reading[0]
|
48
|
+
current=UTCReading.new(reading[0], reading[1]);
|
49
49
|
retval << current;
|
50
50
|
}
|
51
51
|
return retval
|
@@ -56,12 +56,14 @@ module Flukso
|
|
56
56
|
attr_accessor :utc_timestamp, :value
|
57
57
|
def initialize(utc_timestamp, value)
|
58
58
|
# sanity checks.
|
59
|
-
raise Flukso::General, "Invalid reading timestamp: #{utc_timestamp}" if utc_timestamp
|
60
|
-
# TODO: Think about behavior when NaN is reported by the
|
61
|
-
# webservice.
|
59
|
+
raise Flukso::General, "Invalid reading timestamp: #{utc_timestamp}" if utc_timestamp < 0;
|
62
60
|
#raise Flukso::General, "Invalid reading value: #{value}" if value.class != Fixnum || value < 0;
|
63
|
-
@utc_timestamp = utc_timestamp;
|
64
|
-
|
61
|
+
@utc_timestamp = utc_timestamp.to_i;
|
62
|
+
if value =~ /^nan$/i
|
63
|
+
@value=0.0/0.0 # Workaround: Ruby does not allow to assign NaN directly.
|
64
|
+
else
|
65
|
+
@value = value
|
66
|
+
end
|
65
67
|
end
|
66
68
|
def to_s
|
67
69
|
return "#{@utc_timestamp} -> #{@value}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flukso4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Dalheimer
|
@@ -72,5 +72,5 @@ signing_key:
|
|
72
72
|
specification_version: 3
|
73
73
|
summary: A Ruby Library for the Flukso Webservice
|
74
74
|
test_files:
|
75
|
-
- test/test_flukso4r.rb
|
76
75
|
- test/helper.rb
|
76
|
+
- test/test_flukso4r.rb
|