fitbit 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/fitbit.rb CHANGED
@@ -4,5 +4,5 @@ require 'oauth'
4
4
  require 'fitbit/client'
5
5
 
6
6
  module Fitbit
7
- VERSION = "0.1.0"
7
+ VERSION = "0.1.1"
8
8
  end
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.0
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-03-24 00:00:00 -05:00
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