garmin_connectr 0.0.7 → 0.0.8

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.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Adam Roth
1
+ Copyright (c) 2009-2012 Adam Roth
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -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: 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.
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) 2010 Adam Roth. See LICENSE for details.
43
+ Copyright (c) 2009-2012 Adam Roth. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -1,111 +1,116 @@
1
- Scenario: Load Activity
2
- Given I have loaded activity 30051790
3
- Then the name should be "MTB - Mesh RDL "
4
- And the device should be "Garmin Edge 500"
5
- And the url should be "http://connect.garmin.com/activity/30051790"
6
- And the activity_type should be "Mountain Biking"
7
- And the event_type should be "Training"
8
- And the timestamp should be "Wed, Apr 14, 2010 1:46 PM"
9
- And the time should be "00:55:15"
10
- And the distance should be "5.26 mi"
11
- And the elevation_gain should be "610 ft"
12
- And the calories should be "433 C"
13
- And the avg_temperature should be "74.4 °F"
14
- And the moving_time should be "00:35:39"
15
- And the elapsed_time should be "00:55:15"
16
- And the avg_speed should be "5.7 mph"
17
- And the avg_moving_speed should be "8.9 mph"
18
- And the max_speed should be "27.1 mph"
19
- And the avg_pace should be "10:30 min/mi"
20
- And the avg_moving_pace should be "06:46 min/mi"
21
- And the best_pace should be "02:12 min/mi"
22
- And the elevation_loss should be "615 ft"
23
- And the min_elevation should be "334 ft"
24
- And the max_elevation should be "886 ft"
25
- And the avg_hr_bpm should be "132 bpm"
26
- And the max_hr_bpm should be "172 bpm"
27
- And the avg_hr_pom should be "67 % of Max"
28
- And the max_hr_pom should be "87 % of Max"
29
- And the avg_hr_hrzones should be "1.0 z"
30
- And the max_hr_hrzones should be "3.9 z"
31
- And the avg_bike_cadence should be "84 rpm"
32
- And the max_bike_cadence should be "166 rpm"
33
- And the avg_temperature should be "74.4 °F"
34
- And the min_temperature should be "73.4 °F"
35
- And the max_temperature should be "78.8 °F"
36
- And the split_count should be "3"
37
-
38
- Scenario: Load Activity with Splits
39
- Given I have loaded activity 30051790
40
- Then the split_count should be "3"
41
-
42
- And the time for split 1 should be "00:08:51"
43
- And the time for split 2 should be "00:26:16"
44
- And the time for split 3 should be "00:20:07"
45
-
46
- And the moving_time for split 1 should be "00:05:42"
47
- And the moving_time for split 2 should be "00:16:18"
48
- And the moving_time for split 3 should be "00:13:39"
49
-
50
- And the distance for split 1 should be "1.55"
51
- And the distance for split 2 should be "1.85"
52
- And the distance for split 3 should be "1.87"
53
-
54
- And the elevation_gain for split 1 should be "44"
55
- And the elevation_gain for split 2 should be "483"
56
- And the elevation_gain for split 3 should be "82"
57
-
58
- And the elevation_loss for split 1 should be "368"
59
- And the elevation_loss for split 2 should be "0"
60
- And the elevation_loss for split 3 should be "247"
61
-
62
- And the avg_speed for split 1 should be "10.5"
63
- And the avg_speed for split 2 should be "4.2"
64
- And the avg_speed for split 3 should be "5.6"
65
-
66
- And the avg_moving_speed for split 1 should be "16.3"
67
- And the avg_moving_speed for split 2 should be "6.8"
68
- And the avg_moving_speed for split 3 should be "8.2"
69
-
70
- And the max_speed for split 1 should be "27.1"
71
- And the max_speed for split 2 should be "13.2"
72
- And the max_speed for split 3 should be "25.8"
73
-
74
- And the avg_hr for split 1 should be "111"
75
- And the avg_hr for split 2 should be "141"
76
- And the avg_hr for split 3 should be "131"
77
-
78
- And the max_hr for split 1 should be "135"
79
- And the max_hr for split 2 should be "172"
80
- And the max_hr for split 3 should be "166"
81
-
82
- And the avg_bike_cadence for split 1 should be "92"
83
- And the avg_bike_cadence for split 2 should be "82"
84
- And the avg_bike_cadence for split 3 should be "84"
85
-
86
- And the max_bike_cadence for split 1 should be "146"
87
- And the max_bike_cadence for split 2 should be "146"
88
- And the max_bike_cadence for split 3 should be "166"
89
-
90
- And the calories for split 1 should be "15"
91
- And the calories for split 2 should be "266"
92
- And the calories for split 3 should be "152"
93
-
94
- And the avg_temp for split 1 should be "75.6"
95
- And the avg_temp for split 2 should be "74.7"
96
- And the avg_temp for split 3 should be "73.4"
97
-
98
- And the time for split summary should be "00:55:15"
99
- And the moving_time for split summary should be "00:35:39"
100
- And the distance for split summary should be "5.26"
101
- And the elevation_gain for split summary should be "610"
102
- And the elevation_loss for split summary should be "615"
103
- And the avg_speed for split summary should be "5.7"
104
- And the avg_moving_speed for split summary should be "8.9"
105
- And the max_speed for split summary should be "27.1"
106
- And the avg_hr for split summary should be "132"
107
- And the max_hr for split summary should be "172"
108
- And the avg_bike_cadence for split summary should be "84"
109
- And the max_bike_cadence for split summary should be "166"
110
- And the calories for split summary should be "433"
111
- And the avg_temp for split summary should be "74.4"
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
- Scenario: Load Activity List
2
- Given I have loaded the activity list for username USERNAME with password PASSWORD
3
- Then the activity list should contain some activities
4
- And the first activity should have a name
5
- And the first activity should have a distance
6
- And the first activity should have a activity_type
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
@@ -1,57 +1,50 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
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 = %q{garmin_connectr}
8
- s.version = "0.0.7"
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 = %q{2010-04-17}
13
- s.description = %q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
14
- s.email = %q{adamjroth@gmail.com}
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
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".gemspec",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "examples/activity.rb",
27
- "examples/activity_list.rb",
28
- "features/activity.feature",
29
- "features/activity_list.feature",
30
- "features/step_definitions/activity_list_steps.rb",
31
- "features/step_definitions/activity_steps.rb",
32
- "features/support/env.rb",
33
- "garmin_connectr.gemspec",
34
- "lib/garmin_connectr.rb",
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 = %q{http://github.com/aroth/garmin_connectr}
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 = %q{1.3.6}
41
- s.summary = %q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
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::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
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
+
@@ -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
- @data[name.to_sym]
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
- prerelease: false
4
+ hash: 15
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 7
9
- version: 0.0.7
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: 2010-04-17 00:00:00 -04:00
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
- - --charset=UTF-8
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.3.6
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
- - test/garmin_connectr_test.rb
79
- - examples/activity.rb
80
- - examples/activity_list.rb
79
+ test_files: []
80
+
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- .document
7
- doc