garmin_connectr 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +3 -2
- data/VERSION +1 -1
- data/features/activity.feature +116 -111
- data/features/activity_list.feature +7 -6
- data/garmin_connectr.gemspec +27 -34
- data/lib/garmin_connectr.rb +13 -2
- metadata +14 -14
- data/.gitignore +0 -7
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
GarminConnectr is a simple Ruby library for accessing data from Garmin Connect. As of 12/2009, Garmin's own Connect API has yet to be released. Until then, this screen scraping lib does the job.
|
4
4
|
|
5
5
|
CHANGELOG:
|
6
|
-
0.
|
6
|
+
0.0.8: Updated code to handle naming changing on Garmin's end (ex: max_elevation is now maxelevation); updated tests.
|
7
|
+
0.0.6: The Garmin Connect interface has been updated. I have rewritten most of garmin_connectr and added several cucumber tests. The API has changed. Please see the example usage below.
|
7
8
|
|
8
9
|
Install:
|
9
10
|
|
@@ -39,4 +40,4 @@ See examples/*
|
|
39
40
|
|
40
41
|
== Copyright
|
41
42
|
|
42
|
-
Copyright (c)
|
43
|
+
Copyright (c) 2009-2012 Adam Roth. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/features/activity.feature
CHANGED
@@ -1,111 +1,116 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
1
|
+
Feature: Load Activities
|
2
|
+
Scenario: Load Basic Activity
|
3
|
+
Given I have loaded activity 30051790
|
4
|
+
Then the name should be "MTB - Mesh RDL"
|
5
|
+
And the device should be "Garmin Edge 500"
|
6
|
+
And the url should be "http://connect.garmin.com/activity/30051790"
|
7
|
+
And the activity_type should be "Mountain Biking"
|
8
|
+
And the event_type should be "Training"
|
9
|
+
And the timestamp should be "Wed, 14 Apr 2010 13:46 Eastern Time (US & Canada)"
|
10
|
+
And the time should be "55:15"
|
11
|
+
And the distance should be "5.26 mi"
|
12
|
+
And the elevation_gain should be "610 ft"
|
13
|
+
And the calories should be "433 C"
|
14
|
+
And the avg_temperature should be "74.4 °F"
|
15
|
+
And the moving_time should be "35:39"
|
16
|
+
And the elapsed_time should be "55:15"
|
17
|
+
And the avg_speed should be "5.7 mph"
|
18
|
+
And the avg_moving_speed should be "8.9 mph"
|
19
|
+
And the max_speed should be "27.1 mph"
|
20
|
+
And the avg_pace should be "10:30 min/mi"
|
21
|
+
And the avg_moving_pace should be "6:47 min/mi"
|
22
|
+
And the best_pace should be "2:13 min/mi"
|
23
|
+
And the elevation_loss should be "615 ft"
|
24
|
+
And the min_elevation should be "334 ft"
|
25
|
+
And the max_elevation should be "886 ft"
|
26
|
+
And the avg_hr_bpm should be "132 bpm"
|
27
|
+
And the max_hr_bpm should be "172 bpm"
|
28
|
+
And the avg_hr_pom should be "71 % of Max"
|
29
|
+
And the max_hr_pom should be "93 % of Max"
|
30
|
+
And the avg_hr_hrzones should be "1.7 z"
|
31
|
+
And the max_hr_hrzones should be "5.3 z"
|
32
|
+
And the avg_bike_cadence should be "84 rpm"
|
33
|
+
And the max_bike_cadence should be "166 rpm"
|
34
|
+
And the avg_temperature should be "74.4 °F"
|
35
|
+
And the min_temperature should be "73.4 °F"
|
36
|
+
And the max_temperature should be "78.8 °F"
|
37
|
+
And the split_count should be "3"
|
38
|
+
|
39
|
+
Scenario: Load Activity with Splits
|
40
|
+
Given I have loaded activity 30051790
|
41
|
+
Then the split_count should be "3"
|
42
|
+
|
43
|
+
And the time for split 1 should be "8:51.5"
|
44
|
+
And the time for split 2 should be "26:16.3"
|
45
|
+
And the time for split 3 should be "20:07.5"
|
46
|
+
|
47
|
+
And the moving_time for split 1 should be "5:42"
|
48
|
+
And the moving_time for split 2 should be "16:18"
|
49
|
+
And the moving_time for split 3 should be "13:39"
|
50
|
+
|
51
|
+
And the distance for split 1 should be "1.55"
|
52
|
+
And the distance for split 2 should be "1.85"
|
53
|
+
And the distance for split 3 should be "1.87"
|
54
|
+
|
55
|
+
And the elevation_gain for split 1 should be "44"
|
56
|
+
And the elevation_gain for split 2 should be "483"
|
57
|
+
And the elevation_gain for split 3 should be "82"
|
58
|
+
|
59
|
+
And the elevation_loss for split 1 should be "368"
|
60
|
+
And the elevation_loss for split 2 should be "0"
|
61
|
+
And the elevation_loss for split 3 should be "247"
|
62
|
+
|
63
|
+
And the avg_speed for split 1 should be "10.5"
|
64
|
+
And the avg_speed for split 2 should be "4.2"
|
65
|
+
And the avg_speed for split 3 should be "5.6"
|
66
|
+
|
67
|
+
And the avg_moving_speed for split 1 should be "16.3"
|
68
|
+
And the avg_moving_speed for split 2 should be "6.8"
|
69
|
+
And the avg_moving_speed for split 3 should be "8.2"
|
70
|
+
|
71
|
+
And the max_speed for split 1 should be "27.1"
|
72
|
+
And the max_speed for split 2 should be "13.2"
|
73
|
+
And the max_speed for split 3 should be "25.8"
|
74
|
+
|
75
|
+
And the avg_hr for split 1 should be "111"
|
76
|
+
And the avg_hr for split 2 should be "141"
|
77
|
+
And the avg_hr for split 3 should be "131"
|
78
|
+
|
79
|
+
And the max_hr for split 1 should be "135"
|
80
|
+
And the max_hr for split 2 should be "172"
|
81
|
+
And the max_hr for split 3 should be "166"
|
82
|
+
|
83
|
+
And the avg_bike_cadence for split 1 should be "92"
|
84
|
+
And the avg_bike_cadence for split 2 should be "82"
|
85
|
+
And the avg_bike_cadence for split 3 should be "84"
|
86
|
+
|
87
|
+
And the max_bike_cadence for split 1 should be "146"
|
88
|
+
And the max_bike_cadence for split 2 should be "146"
|
89
|
+
And the max_bike_cadence for split 3 should be "166"
|
90
|
+
|
91
|
+
And the calories for split 1 should be "15"
|
92
|
+
And the calories for split 2 should be "266"
|
93
|
+
And the calories for split 3 should be "152"
|
94
|
+
|
95
|
+
And the avg_temp for split 1 should be "75.6"
|
96
|
+
And the avg_temp for split 2 should be "74.7"
|
97
|
+
And the avg_temp for split 3 should be "73.4"
|
98
|
+
|
99
|
+
And the avg_temperature for split 1 should be "75.6"
|
100
|
+
And the avg_temperature for split 2 should be "74.7"
|
101
|
+
And the avg_temperature for split 3 should be "73.4"
|
102
|
+
|
103
|
+
And the time for split summary should be "55:15.3"
|
104
|
+
And the moving_time for split summary should be "35:39.0"
|
105
|
+
And the distance for split summary should be "5.26"
|
106
|
+
And the elevation_gain for split summary should be "610"
|
107
|
+
And the elevation_loss for split summary should be "615"
|
108
|
+
And the avg_speed for split summary should be "5.7"
|
109
|
+
And the avg_moving_speed for split summary should be "8.9"
|
110
|
+
And the max_speed for split summary should be "27.1"
|
111
|
+
And the avg_hr for split summary should be "132"
|
112
|
+
And the max_hr for split summary should be "172"
|
113
|
+
And the avg_bike_cadence for split summary should be "84"
|
114
|
+
And the max_bike_cadence for split summary should be "166"
|
115
|
+
And the calories for split summary should be "433"
|
116
|
+
And the avg_temp for split summary should be "74.4"
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
Feature: Load Activity List
|
2
|
+
Scenario: Load Activity List
|
3
|
+
Given I have loaded the activity list for username USERNAME with password PASSWORD
|
4
|
+
Then the activity list should contain some activities
|
5
|
+
And the first activity should have a name
|
6
|
+
And the first activity should have a distance
|
7
|
+
And the first activity should have a activity_type
|
data/garmin_connectr.gemspec
CHANGED
@@ -1,57 +1,50 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0.
|
7
|
+
s.name = "garmin_connectr"
|
8
|
+
s.version = "0.0.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["aroth"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-01-27"
|
13
|
+
s.description = "GarminConnectr is a simple Ruby library for accessing data from Garmin Connect."
|
14
|
+
s.email = "adamjroth@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".gemspec",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"test/garmin_connectr_test.rb"
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"examples/activity.rb",
|
26
|
+
"examples/activity_list.rb",
|
27
|
+
"features/activity.feature",
|
28
|
+
"features/activity_list.feature",
|
29
|
+
"features/step_definitions/activity_list_steps.rb",
|
30
|
+
"features/step_definitions/activity_steps.rb",
|
31
|
+
"features/support/env.rb",
|
32
|
+
"garmin_connectr.gemspec",
|
33
|
+
"lib/garmin_connectr.rb",
|
34
|
+
"test/garmin_connectr_test.rb"
|
36
35
|
]
|
37
|
-
s.homepage =
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.homepage = "http://github.com/aroth/garmin_connectr"
|
39
37
|
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version =
|
41
|
-
s.summary =
|
42
|
-
s.test_files = [
|
43
|
-
"test/garmin_connectr_test.rb",
|
44
|
-
"examples/activity.rb",
|
45
|
-
"examples/activity_list.rb"
|
46
|
-
]
|
38
|
+
s.rubygems_version = "1.8.15"
|
39
|
+
s.summary = "GarminConnectr is a simple Ruby library for accessing data from Garmin Connect."
|
47
40
|
|
48
41
|
if s.respond_to? :specification_version then
|
49
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
42
|
s.specification_version = 3
|
51
43
|
|
52
|
-
if Gem::Version.new(Gem::
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
45
|
else
|
54
46
|
end
|
55
47
|
else
|
56
48
|
end
|
57
49
|
end
|
50
|
+
|
data/lib/garmin_connectr.rb
CHANGED
@@ -141,8 +141,15 @@ class GarminConnectrActivity
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def method_missing(name)
|
144
|
+
|
144
145
|
self.load! if !@data[name.to_sym] and !@loaded # lazy loading
|
145
|
-
@data[name.to_sym]
|
146
|
+
ret = @data[name.to_sym]
|
147
|
+
|
148
|
+
## Got nothing? Try a variation: Garmin changed a few fields:
|
149
|
+
## => min_elevation => minelevation, max_elevation => maxelevation
|
150
|
+
ret = @data[name.to_s.gsub('_','').to_sym] if ret == nil
|
151
|
+
|
152
|
+
ret
|
146
153
|
end
|
147
154
|
|
148
155
|
end
|
@@ -163,7 +170,11 @@ class GarminConnectrActivitySplit
|
|
163
170
|
private
|
164
171
|
|
165
172
|
def method_missing(name)
|
166
|
-
|
173
|
+
## backwards compatibility
|
174
|
+
name = 'avg_temperature' if name.to_s == 'avg_temp'
|
175
|
+
|
176
|
+
ret = @data[name.to_sym]
|
177
|
+
ret
|
167
178
|
end
|
168
179
|
|
169
180
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garmin_connectr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- aroth
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2012-01-27 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.
|
@@ -29,7 +29,6 @@ extra_rdoc_files:
|
|
29
29
|
- README.rdoc
|
30
30
|
files:
|
31
31
|
- .gemspec
|
32
|
-
- .gitignore
|
33
32
|
- LICENSE
|
34
33
|
- README.rdoc
|
35
34
|
- Rakefile
|
@@ -44,37 +43,38 @@ files:
|
|
44
43
|
- garmin_connectr.gemspec
|
45
44
|
- lib/garmin_connectr.rb
|
46
45
|
- test/garmin_connectr_test.rb
|
47
|
-
has_rdoc: true
|
48
46
|
homepage: http://github.com/aroth/garmin_connectr
|
49
47
|
licenses: []
|
50
48
|
|
51
49
|
post_install_message:
|
52
|
-
rdoc_options:
|
53
|
-
|
50
|
+
rdoc_options: []
|
51
|
+
|
54
52
|
require_paths:
|
55
53
|
- lib
|
56
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
57
56
|
requirements:
|
58
57
|
- - ">="
|
59
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
60
|
segments:
|
61
61
|
- 0
|
62
62
|
version: "0"
|
63
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
64
65
|
requirements:
|
65
66
|
- - ">="
|
66
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
67
69
|
segments:
|
68
70
|
- 0
|
69
71
|
version: "0"
|
70
72
|
requirements: []
|
71
73
|
|
72
74
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.8.15
|
74
76
|
signing_key:
|
75
77
|
specification_version: 3
|
76
78
|
summary: GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.
|
77
|
-
test_files:
|
78
|
-
|
79
|
-
- examples/activity.rb
|
80
|
-
- examples/activity_list.rb
|
79
|
+
test_files: []
|
80
|
+
|