fitbit 0.1.0 → 0.1.1
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/lib/fitbit.rb +1 -1
- data/lib/fitbit/client.rb +2 -1
- data/lib/fitbit/notifications.rb +40 -0
- data/spec/fitbit_spec.rb +4 -0
- metadata +3 -2
data/lib/fitbit.rb
CHANGED
data/lib/fitbit/client.rb
CHANGED
@@ -7,6 +7,7 @@ require 'fitbit/foods'
|
|
7
7
|
require 'fitbit/weight'
|
8
8
|
require 'fitbit/time_range'
|
9
9
|
require 'fitbit/devices'
|
10
|
+
require 'fitbit/notifications'
|
10
11
|
require 'date'
|
11
12
|
require 'uri'
|
12
13
|
|
@@ -23,7 +24,7 @@ module Fitbit
|
|
23
24
|
@token = options[:token]
|
24
25
|
@secret = options[:secret]
|
25
26
|
@proxy = options[:proxy]
|
26
|
-
@user_id = options[:user_id]
|
27
|
+
@user_id = options[:user_id] || "-"
|
27
28
|
@api_unit_system = Fitbit::ApiUnitSystem.US
|
28
29
|
@api_version = "1"
|
29
30
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fitbit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def create_general_subscription(options={})
|
5
|
+
url = "/user/#{@user_id}/apiSubscriptions"
|
6
|
+
if options[:subscription_id]
|
7
|
+
url += "/#{options[:subscription_id]}"
|
8
|
+
end
|
9
|
+
if options[:subscription_response_format]
|
10
|
+
url += ".#{options[:subscription_response_format]}"
|
11
|
+
else
|
12
|
+
url += ".json"
|
13
|
+
end
|
14
|
+
# puts "Url: #{url}"
|
15
|
+
# resp = post(url)
|
16
|
+
# p resp
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_food_subscription
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_activity_subscription
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_sleep_subscription
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_body_subscription
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove_subscription
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/spec/fitbit_spec.rb
CHANGED
@@ -26,6 +26,10 @@ describe Fitbit do
|
|
26
26
|
@client.api_unit_system = Fitbit::ApiUnitSystem.METRIC
|
27
27
|
@client.api_unit_system.should == Fitbit::ApiUnitSystem.METRIC
|
28
28
|
end
|
29
|
+
|
30
|
+
it 'should default to a user id of \'-\', the currently-logged in user' do
|
31
|
+
@client.user_id.should == '-'
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
describe "data retrieval by time range" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: fitbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Zachery Moneypenny
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-04-11 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/fitbit/errors.rb
|
60
60
|
- lib/fitbit/foods.rb
|
61
61
|
- lib/fitbit/helpers.rb
|
62
|
+
- lib/fitbit/notifications.rb
|
62
63
|
- lib/fitbit/time_range.rb
|
63
64
|
- lib/fitbit/units.rb
|
64
65
|
- lib/fitbit/users.rb
|