fit4ruby 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fit4ruby/Activity.rb +6 -0
- data/lib/fit4ruby/GlobalFitMessages.rb +2 -1
- data/lib/fit4ruby/version.rb +1 -1
- data/spec/FileNameCoder_spec.rb +11 -8
- data/spec/FitFile_spec.rb +4 -2
- data/spec/GeoMath_spec.rb +4 -2
- data/tasks/changelog.rake +1 -1
- data/tasks/test.rake +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8031616797fec0865e6ba35680ec240f5b7264f
|
4
|
+
data.tar.gz: c9b0255d76f4776dc2259cc91ce784e8295a3394
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b252ae0a5993c9bc53fc95bcea5a75aa798af444b30e62378a1f1bff10b76196bd18c9f34945136a7c09e5b8022ca56ee96a4f9281b1dee3b347d37c5a7316
|
7
|
+
data.tar.gz: 1028184b60ca4aa62db0378199006f97563c13f96b4b50868256e107043a95d0ae416a30fdabc4f75d0053dc232b6bca4f84ea6c587958eb37342e35d2e55abd
|
data/lib/fit4ruby/Activity.rb
CHANGED
@@ -195,9 +195,15 @@ module Fit4Ruby
|
|
195
195
|
# Returns the computed VO2max value. This value is computed by the device
|
196
196
|
# based on multiple previous activities.
|
197
197
|
def vo2max
|
198
|
+
# First check the event log for a vo2max reporting event.
|
198
199
|
@events.each do |e|
|
199
200
|
return e.vo2max if e.event == 'vo2max'
|
200
201
|
end
|
202
|
+
# Then check the user_profile entries for a metmax entry. METmax * 3.5
|
203
|
+
# is same value as VO2max.
|
204
|
+
@user_profiles.each do |u|
|
205
|
+
return u.metmax * 3.5 if u.metmax
|
206
|
+
end
|
201
207
|
|
202
208
|
nil
|
203
209
|
end
|
@@ -245,6 +245,7 @@ module Fit4Ruby
|
|
245
245
|
field 83, 'uint16', 'vertical_ratio', :scale => 100, :unit => '%' # guessed
|
246
246
|
field 84, 'uint16', 'gct_balance', :scale => 100, :unit => '%' # guessed
|
247
247
|
field 85, 'uint16', 'stride_length', :scale => 10000, :unit => 'm' # guessed
|
248
|
+
field 87, 'uint16', 'undefined_value_87' # first seen on F3 FW6.80
|
248
249
|
field 253, 'uint32', 'timestamp', :type => 'date_time'
|
249
250
|
|
250
251
|
message 21, 'event'
|
@@ -400,7 +401,7 @@ module Fit4Ruby
|
|
400
401
|
|
401
402
|
# Not part of the official ANT SDK doc
|
402
403
|
message 79, 'user_profile'
|
403
|
-
field 0, 'uint16', '
|
404
|
+
field 0, 'uint16', 'metmax', :scale => 1000, :unit => 'MET' # VO2max / 3.5
|
404
405
|
field 1, 'uint8', 'age', :unit => 'years'
|
405
406
|
field 2, 'uint8', 'height', :scale => 100, :unit => 'm'
|
406
407
|
field 3, 'uint16', 'weight', :scale => 10, :unit => 'kg'
|
data/lib/fit4ruby/version.rb
CHANGED
data/spec/FileNameCoder_spec.rb
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
# published by the Free Software Foundation.
|
11
11
|
#
|
12
12
|
|
13
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
|
15
|
+
require 'time'
|
13
16
|
require 'fit4ruby/FileNameCoder'
|
14
17
|
|
15
18
|
describe Fit4Ruby::FileNameCoder do
|
@@ -25,35 +28,35 @@ describe Fit4Ruby::FileNameCoder do
|
|
25
28
|
|
26
29
|
it 'should convert a time stamps to a file names' do
|
27
30
|
@data.each do |t|
|
28
|
-
Fit4Ruby::FileNameCoder.encode(Time.parse(t[0])).
|
31
|
+
expect(Fit4Ruby::FileNameCoder.encode(Time.parse(t[0]))).to eq(t[1])
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
35
|
it 'should convert file names to time stamps' do
|
33
36
|
@data.each do |t|
|
34
|
-
Fit4Ruby::FileNameCoder.decode(t[1]).
|
37
|
+
expect(Fit4Ruby::FileNameCoder.decode(t[1])).to eq(Time.parse(t[0]).utc)
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
41
|
it 'should fail to encode dates before 2010' do
|
39
|
-
|
42
|
+
expect {
|
40
43
|
Fit4Ruby::FileNameCoder.encode(Time.parse('2009-12-31T00:00'))
|
41
|
-
}.
|
44
|
+
}.to raise_error(ArgumentError)
|
42
45
|
end
|
43
46
|
|
44
47
|
it 'should fail to encode dates after 2033' do
|
45
|
-
|
48
|
+
expect {
|
46
49
|
Fit4Ruby::FileNameCoder.encode(Time.parse('2034-01-01T00:00+00:00'))
|
47
|
-
}.
|
50
|
+
}.to raise_error(ArgumentError)
|
48
51
|
end
|
49
52
|
|
50
53
|
it 'should fail to decode illegal file names' do
|
51
54
|
[ 'A.FIT', '0123ABCD', '5ZNJ1800.FIT',
|
52
55
|
'44063106.FIT', '44W63106.FIT',
|
53
56
|
'557O1650.FIT', '557G6050.FIT', '557G1660.FIT' ].each do |name|
|
54
|
-
|
57
|
+
expect {
|
55
58
|
Fit4Ruby::FileNameCoder.decode(name)
|
56
|
-
}.
|
59
|
+
}.to raise_error(ArgumentError)
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
data/spec/FitFile_spec.rb
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
# published by the Free Software Foundation.
|
11
11
|
#
|
12
12
|
|
13
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
|
13
15
|
require 'fit4ruby'
|
14
16
|
|
15
17
|
describe Fit4Ruby do
|
@@ -104,10 +106,10 @@ describe Fit4Ruby do
|
|
104
106
|
|
105
107
|
File.delete(fit_file) if File.exists?(fit_file)
|
106
108
|
Fit4Ruby.write(fit_file, @activity)
|
107
|
-
File.exists?(fit_file).
|
109
|
+
expect(File.exists?(fit_file)).to be true
|
108
110
|
|
109
111
|
b = Fit4Ruby.read(fit_file)
|
110
|
-
b.
|
112
|
+
expect(b).to eq(@activity)
|
111
113
|
File.delete(fit_file)
|
112
114
|
end
|
113
115
|
|
data/spec/GeoMath_spec.rb
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
# published by the Free Software Foundation.
|
11
11
|
#
|
12
12
|
|
13
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
|
13
15
|
require 'fit4ruby/GeoMath'
|
14
16
|
|
15
17
|
describe Fit4Ruby::GeoMath do
|
@@ -25,8 +27,8 @@ describe Fit4Ruby::GeoMath do
|
|
25
27
|
[ 48.17970883101225, 11.611351054161787, 100.225 ]
|
26
28
|
]
|
27
29
|
points.each do |p|
|
28
|
-
Fit4Ruby::GeoMath.distance(
|
29
|
-
|
30
|
+
expect(Fit4Ruby::GeoMath.distance(
|
31
|
+
p0_lat, p0_lon, p[0], p[1])).to be_within(0.001).of(p[2])
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
data/tasks/changelog.rake
CHANGED
@@ -155,7 +155,7 @@ task :changelog do
|
|
155
155
|
def getReleaseVersions
|
156
156
|
# Get list of release tags from Git repository
|
157
157
|
releaseVersions = `git tag`.split("\n").map { |r| r.chomp }.
|
158
|
-
delete_if { |r| ! (/
|
158
|
+
delete_if { |r| ! (/v\d+\.\d+\.\d+/ =~ r) }.
|
159
159
|
sort{ |a, b| compareTags(a, b) }
|
160
160
|
releaseVersions << 'HEAD'
|
161
161
|
end
|
data/tasks/test.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fit4ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schlaeger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.4.5.1
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Library to read GARMIN FIT files.
|