fitgem 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rvmrc +1 -1
- data/Gemfile +9 -0
- data/Guardfile +1 -1
- data/README.md +41 -26
- data/fitgem.gemspec +0 -4
- data/lib/fitgem/activities.rb +8 -0
- data/lib/fitgem/version.rb +1 -1
- metadata +23 -42
data/.gitignore
CHANGED
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm ruby-1.9.3-
|
1
|
+
rvm ruby-1.9.3-p327@fitgem --create
|
data/Gemfile
CHANGED
@@ -2,3 +2,12 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in fitgem.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'guard-rspec'
|
8
|
+
gem 'fuubar'
|
9
|
+
gem 'rb-inotify', :require => false
|
10
|
+
gem 'rb-fsevent', :require => false
|
11
|
+
gem 'rb-fchange', :require => false
|
12
|
+
gem 'terminal-notifier-guard'
|
13
|
+
end
|
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
guard 'rspec', :version => 2 do
|
4
|
+
guard 'rspec', :cli => "--color --format Fuubar --fail-fast", :version => 2 do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
7
|
watch('spec/spec_helper.rb') { "spec" }
|
data/README.md
CHANGED
@@ -1,45 +1,50 @@
|
|
1
1
|
# Fitgem [![Build Status](https://secure.travis-ci.org/whazzmaster/fitgem.png)](http://travis-ci.org/whazzmaster/fitgem)
|
2
2
|
|
3
|
-
Provides access to fitbit.com data through their OAuth/REST API. Fitgem can pull data with or without user
|
3
|
+
Provides access to fitbit.com data through their OAuth/REST API. Fitgem can pull data with or without user
|
4
|
+
authentication. Without user authentication, any data that the a fitbit.com user has denoted as 'public' can be
|
5
|
+
gathered. If a user logs in via OAuth then all exposed data can be gathered.
|
4
6
|
|
5
|
-
The fitbit.com
|
7
|
+
The [Fitbit API](https://wiki.fitbit.com/display/API/Fitbit+API) is currently in BETA and is under
|
8
|
+
development to extend its reach. Since it is early in the lifecycle of the API I expect this gem to go through a number
|
9
|
+
of revisions as we attempt to match the functionality of their platform.
|
6
10
|
|
7
|
-
# Usage
|
11
|
+
# Usage
|
8
12
|
|
9
13
|
Install fitgem:
|
10
14
|
```
|
11
15
|
$ gem install fitgem
|
12
16
|
```
|
13
17
|
|
14
|
-
|
18
|
+
Comprehensive method documentation is [available online](http://www.rubydoc.info/github/whazzmaster/fitgem/frames).
|
15
19
|
|
16
|
-
|
20
|
+
[The wiki has information](https://github.com/whazzmaster/fitgem/wiki/The-OAuth-Process) on how to use fitgem in the
|
21
|
+
OAuth handshake with [fitbit.com](http://www.fitbit.com). You may also be interested in using
|
22
|
+
[omniauth-fitbit](https://github.com/tkgospodinov/omniauth-fitbit) to integrate Fitbit accounts into your web
|
23
|
+
application.
|
17
24
|
|
18
|
-
|
25
|
+
## Usage in a Rails Application
|
19
26
|
|
20
|
-
|
27
|
+
We've started to develop an example app using the fitgem client.
|
28
|
+
See [https://github.com/whazzmaster/fitgem-client](https://github.com/whazzmaster/fitgem-client) for more information or
|
29
|
+
check out [the hosted version](http://www.fitbitclient.com). The fitgem-client project is evolving more slowly than the
|
30
|
+
library itself, but work continues.
|
21
31
|
|
22
|
-
|
32
|
+
# Subscriptions
|
23
33
|
|
24
|
-
|
34
|
+
The Fitbit API allows for you to set up notification subscription so that when values change (via automatic syncs with
|
35
|
+
the fitbit device) your applications can be notified automatically. You can set up a default subscription callback URL
|
36
|
+
via the [Fitbit dev site](https://dev.fitbit.com/ 'Fitbit Developer Site') and then use the Subscriptions API to add or
|
37
|
+
remove subscriptions for individual users.
|
25
38
|
|
26
|
-
|
27
|
-
|
28
|
-
## What About ruby-fitbit?
|
29
|
-
|
30
|
-
There is a good looking gem called [ruby-fitbit](https://github.com/danmayer/ruby-fitbit "ruby-fitbit") that also aims to collect data from the site. It was created before they released their REST API and uses screen-scraping to gather the data rather than through their API. I looked into forking it and refactoring to use the new API but after looking through the code I felt it would be more of a total rewrite and so decided to create a new gem that I could design from scratch.
|
31
|
-
|
32
|
-
## Why the Name Change?
|
33
|
-
|
34
|
-
It turns out that Fitbit.com does not want people to create libraries or applications that incorporate the name 'fitbit'. So, on May 12th, 2011 I changed the name of the project/gem from 'fitbit' to 'fitgem'.
|
35
|
-
|
36
|
-
# Notice
|
37
|
-
|
38
|
-
To be clear: __I am not employed by fitbit.com__. I created this library to assist other ruby developers in creating interesting applications on top of fitbit.com's data store and device data stream.
|
39
|
+
__Currently, notification management is experimental in this gem__. There is currently code to add, remove, and list
|
40
|
+
subscriptions (foods, activities, sleep, body, and all collections).
|
39
41
|
|
40
42
|
# Contributing to fitgem #
|
41
43
|
|
42
|
-
The Fitbit REST API is in BETA right now, and so it will quite likely change over time (though I can't be sure whether
|
44
|
+
The Fitbit REST API is in BETA right now, and so it will quite likely change over time (though I can't be sure whether
|
45
|
+
it will be additive change or change of the non-backwards-compatible variety). I aim to keep as up-to-date as I can but
|
46
|
+
if you absolutely need functionality that isn't included here, feel free to fork and implement it, then send me a pull
|
47
|
+
request.
|
43
48
|
|
44
49
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
45
50
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -47,8 +52,18 @@ The Fitbit REST API is in BETA right now, and so it will quite likely change ove
|
|
47
52
|
* Start a feature/bugfix branch
|
48
53
|
* Commit and push until you are happy with your contribution
|
49
54
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
50
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise
|
55
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise
|
56
|
+
necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
57
|
+
|
58
|
+
## Contributors
|
59
|
+
|
60
|
+
Many thanks to everyone that has contributed to improve fitgem!
|
61
|
+
|
62
|
+
[https://github.com/whazzmaster/fitgem/graphs/contributors](https://github.com/whazzmaster/fitgem/graphs/contributors)
|
63
|
+
|
64
|
+
# Copyright & Disclaimer
|
51
65
|
|
52
|
-
|
66
|
+
Copyright (c) 2011-2012 Zachery Moneypenny. See LICENSE for further details. __I am not employed by fitbit.com__. I
|
67
|
+
created this library to assist other ruby developers in creating interesting applications on top of fitbit.com's
|
68
|
+
data store and device data stream.
|
53
69
|
|
54
|
-
Copyright (c) 2011-2012 Zachery Moneypenny. See LICENSE for further details.
|
data/fitgem.gemspec
CHANGED
@@ -19,10 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency "oauth"
|
20
20
|
s.add_development_dependency "rake"
|
21
21
|
s.add_development_dependency "rspec"
|
22
|
-
s.add_development_dependency "guard"
|
23
|
-
s.add_development_dependency "guard-rspec"
|
24
|
-
s.add_development_dependency "rb-fsevent"
|
25
|
-
s.add_development_dependency "growl"
|
26
22
|
s.add_development_dependency "yard"
|
27
23
|
s.add_development_dependency "rdiscount"
|
28
24
|
|
data/lib/fitgem/activities.rb
CHANGED
@@ -63,6 +63,14 @@ module Fitgem
|
|
63
63
|
get("/user/#{@user_id}/activities.json")
|
64
64
|
end
|
65
65
|
|
66
|
+
# Get the daily activity goals for the current user
|
67
|
+
#
|
68
|
+
# @return [Hash] Hash containing the calorie, distance, floors, and
|
69
|
+
# step goals for the current user
|
70
|
+
def goals
|
71
|
+
get("/user/#{@user_id}/activities/goals/daily.json")
|
72
|
+
end
|
73
|
+
|
66
74
|
# ==========================================
|
67
75
|
# Activity Update Methods
|
68
76
|
# ==========================================
|
data/lib/fitgem/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fitgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rake
|
27
|
-
requirement: &70237035563860 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
26
|
requirements:
|
30
27
|
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '0'
|
33
|
-
type: :development
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70237035563860
|
36
30
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
34
|
requirements:
|
41
35
|
- - ! '>='
|
@@ -43,21 +37,15 @@ dependencies:
|
|
43
37
|
version: '0'
|
44
38
|
type: :development
|
45
39
|
prerelease: false
|
46
|
-
version_requirements:
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: guard
|
49
|
-
requirement: &70237035624880 !ruby/object:Gem::Requirement
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
41
|
none: false
|
51
42
|
requirements:
|
52
43
|
- - ! '>='
|
53
44
|
- !ruby/object:Gem::Version
|
54
45
|
version: '0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *70237035624880
|
58
46
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
61
49
|
none: false
|
62
50
|
requirements:
|
63
51
|
- - ! '>='
|
@@ -65,21 +53,15 @@ dependencies:
|
|
65
53
|
version: '0'
|
66
54
|
type: :development
|
67
55
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rb-fsevent
|
71
|
-
requirement: &70237035622140 !ruby/object:Gem::Requirement
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
57
|
none: false
|
73
58
|
requirements:
|
74
59
|
- - ! '>='
|
75
60
|
- !ruby/object:Gem::Version
|
76
61
|
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: *70237035622140
|
80
62
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement:
|
63
|
+
name: yard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
83
65
|
none: false
|
84
66
|
requirements:
|
85
67
|
- - ! '>='
|
@@ -87,21 +69,15 @@ dependencies:
|
|
87
69
|
version: '0'
|
88
70
|
type: :development
|
89
71
|
prerelease: false
|
90
|
-
version_requirements:
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: yard
|
93
|
-
requirement: &70237035620560 !ruby/object:Gem::Requirement
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
73
|
none: false
|
95
74
|
requirements:
|
96
75
|
- - ! '>='
|
97
76
|
- !ruby/object:Gem::Version
|
98
77
|
version: '0'
|
99
|
-
type: :development
|
100
|
-
prerelease: false
|
101
|
-
version_requirements: *70237035620560
|
102
78
|
- !ruby/object:Gem::Dependency
|
103
79
|
name: rdiscount
|
104
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
105
81
|
none: false
|
106
82
|
requirements:
|
107
83
|
- - ! '>='
|
@@ -109,7 +85,12 @@ dependencies:
|
|
109
85
|
version: '0'
|
110
86
|
type: :development
|
111
87
|
prerelease: false
|
112
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
113
94
|
description: A client library to send and retrieve workout, weight, and diet data
|
114
95
|
from fitbit.com
|
115
96
|
email:
|
@@ -168,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
149
|
version: '0'
|
169
150
|
segments:
|
170
151
|
- 0
|
171
|
-
hash:
|
152
|
+
hash: -1377905126608212630
|
172
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
154
|
none: false
|
174
155
|
requirements:
|
@@ -177,10 +158,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
158
|
version: '0'
|
178
159
|
segments:
|
179
160
|
- 0
|
180
|
-
hash:
|
161
|
+
hash: -1377905126608212630
|
181
162
|
requirements: []
|
182
163
|
rubyforge_project: fitgem
|
183
|
-
rubygems_version: 1.8.
|
164
|
+
rubygems_version: 1.8.24
|
184
165
|
signing_key:
|
185
166
|
specification_version: 3
|
186
167
|
summary: OAuth client library to the data on fitbit.com
|