garmin_connectr 0.0.2 → 0.0.3
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/.gemspec +48 -0
- data/.gitignore +2 -0
- data/README.rdoc +19 -1
- data/Rakefile +18 -16
- data/VERSION +1 -1
- data/examples/activity.rb +2 -1
- data/garmin_connectr.gemspec +52 -0
- data/lib/garmin_connectr.rb +4 -4
- metadata +7 -4
- data/.document +0 -5
data/.gemspec
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = nil
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.date = %q{2009-12-23}
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"LICENSE",
|
14
|
+
"README.rdoc"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
".gemspec",
|
18
|
+
".gitignore",
|
19
|
+
"LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"examples/activity.rb",
|
24
|
+
"examples/activity_list.rb",
|
25
|
+
"garmin_connectr.gemspec",
|
26
|
+
"lib/garmin_connectr.rb",
|
27
|
+
"test/garmin_connectr_test.rb"
|
28
|
+
]
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.5}
|
32
|
+
s.summary = nil
|
33
|
+
s.test_files = [
|
34
|
+
"test/garmin_connectr_test.rb",
|
35
|
+
"examples/activity.rb",
|
36
|
+
"examples/activity_list.rb"
|
37
|
+
]
|
38
|
+
|
39
|
+
if s.respond_to? :specification_version then
|
40
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
44
|
+
else
|
45
|
+
end
|
46
|
+
else
|
47
|
+
end
|
48
|
+
end
|
data/README.rdoc
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
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.
|
4
4
|
|
5
|
+
Usage:
|
6
|
+
|
7
|
+
require 'garmin_connectr'
|
8
|
+
gc = GarminConnectr.new
|
9
|
+
|
10
|
+
# Load a specific activity
|
11
|
+
activity = gc.load( ACTIVITY_ID )
|
12
|
+
puts "#{ g.activity } / #{ g.name } / #{ g.time } / #{ g.distance }"
|
13
|
+
|
14
|
+
# Load a list of my activities
|
15
|
+
list = gc.activities( garmin_connect_username, garmin_connect_password )
|
16
|
+
list.each do |activity|
|
17
|
+
activity.load!
|
18
|
+
puts "#{ activity.name } / #{ activity.start_time }"
|
19
|
+
end
|
20
|
+
|
21
|
+
See examples/*
|
22
|
+
|
5
23
|
== Copyright
|
6
24
|
|
7
|
-
Copyright (c) 2009 Adam Roth. See LICENSE for details.
|
25
|
+
Copyright (c) 2009 Adam Roth. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,22 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "garmin_connectr"
|
8
|
-
gem.summary = %Q{Simple ruby lib to fetch data from Garmin Connect}
|
9
|
-
gem.description = %Q{The Garmin Connect API hasn't been released yet. This will suffice for now.}
|
10
|
-
gem.email = "adamjroth@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/aroth/garmin_connectr"
|
12
|
-
gem.authors = ["aroth"]
|
13
|
-
#gem.add_development_dependency "thoughtbot-shoulda"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
-
end
|
19
|
-
|
20
4
|
require 'rake/testtask'
|
21
5
|
Rake::TestTask.new(:test) do |test|
|
22
6
|
test.libs << 'lib' << 'test'
|
@@ -54,3 +38,21 @@ Rake::RDocTask.new do |rdoc|
|
|
54
38
|
rdoc.rdoc_files.include('README*')
|
55
39
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
40
|
end
|
41
|
+
|
42
|
+
begin
|
43
|
+
require 'jeweler'
|
44
|
+
Jeweler::Tasks.new do |gem|
|
45
|
+
gem.name = "garmin_connectr"
|
46
|
+
gem.summary = %Q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
|
47
|
+
gem.description = %Q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
|
48
|
+
gem.email = "adamjroth@gmail.com"
|
49
|
+
gem.homepage = "http://github.com/aroth/garmin_connectr"
|
50
|
+
gem.authors = ["aroth"]
|
51
|
+
#gem.add_development_dependency "thoughtbot-shoulda"
|
52
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
53
|
+
end
|
54
|
+
puts "Sending to gemcutter.org"
|
55
|
+
Jeweler::GemcutterTasks.new
|
56
|
+
rescue LoadError
|
57
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
58
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/examples/activity.rb
CHANGED
@@ -8,4 +8,5 @@ activity = gc.load( activity_id )
|
|
8
8
|
puts activity.name
|
9
9
|
puts " Activity : #{ activity.activity }"
|
10
10
|
puts " Distance : #{ activity.distance }"
|
11
|
-
puts " Start : #{ activity.start_time }
|
11
|
+
puts " Start : #{ activity.start_time }"
|
12
|
+
puts " Avg HR : #{ activity.avg_hr }"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{garmin_connectr}
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["aroth"]
|
12
|
+
s.date = %q{2009-12-23}
|
13
|
+
s.description = %q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
|
14
|
+
s.email = %q{adamjroth@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gemspec",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"examples/activity.rb",
|
27
|
+
"examples/activity_list.rb",
|
28
|
+
"garmin_connectr.gemspec",
|
29
|
+
"lib/garmin_connectr.rb",
|
30
|
+
"test/garmin_connectr_test.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/aroth/garmin_connectr}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.5}
|
36
|
+
s.summary = %q{GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.}
|
37
|
+
s.test_files = [
|
38
|
+
"test/garmin_connectr_test.rb",
|
39
|
+
"examples/activity.rb",
|
40
|
+
"examples/activity_list.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
else
|
49
|
+
end
|
50
|
+
else
|
51
|
+
end
|
52
|
+
end
|
data/lib/garmin_connectr.rb
CHANGED
@@ -85,7 +85,7 @@ class GarminConnectActivity
|
|
85
85
|
# Tabbed Fields
|
86
86
|
FIELDS.each do |field|
|
87
87
|
name = field.downcase.gsub(' ','_')
|
88
|
-
self.instance_variable_set("@#{ name }", self.send(
|
88
|
+
self.instance_variable_set("@#{ name }", self.send( :tab_data, field ) )
|
89
89
|
end
|
90
90
|
|
91
91
|
self
|
@@ -93,9 +93,9 @@ class GarminConnectActivity
|
|
93
93
|
|
94
94
|
private
|
95
95
|
|
96
|
-
def tab_data(
|
97
|
-
|
98
|
-
@doc.css('.label').to_a.delete_if { |e| e.inner_html !=
|
96
|
+
def tab_data( label )
|
97
|
+
label += ":" unless label.match(/:$/)
|
98
|
+
@doc.css('.label').to_a.delete_if { |e| e.inner_html != label }.first.parent.children.search('.field').inner_html.strip rescue nil
|
99
99
|
end
|
100
100
|
|
101
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garmin_connectr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aroth
|
@@ -13,7 +13,7 @@ date: 2009-12-23 00:00:00 -05:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.
|
17
17
|
email: adamjroth@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
@@ -23,12 +23,15 @@ extra_rdoc_files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
|
-
- .
|
26
|
+
- .gemspec
|
27
27
|
- .gitignore
|
28
28
|
- LICENSE
|
29
29
|
- README.rdoc
|
30
30
|
- Rakefile
|
31
31
|
- VERSION
|
32
|
+
- examples/activity.rb
|
33
|
+
- examples/activity_list.rb
|
34
|
+
- garmin_connectr.gemspec
|
32
35
|
- lib/garmin_connectr.rb
|
33
36
|
- test/garmin_connectr_test.rb
|
34
37
|
has_rdoc: true
|
@@ -58,7 +61,7 @@ rubyforge_project:
|
|
58
61
|
rubygems_version: 1.3.5
|
59
62
|
signing_key:
|
60
63
|
specification_version: 3
|
61
|
-
summary:
|
64
|
+
summary: GarminConnectr is a simple Ruby library for accessing data from Garmin Connect.
|
62
65
|
test_files:
|
63
66
|
- test/garmin_connectr_test.rb
|
64
67
|
- examples/activity.rb
|