simplificator-withings 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -91,8 +91,11 @@ enable/disable sharing, disabling it will reset the public key
91
91
  user.share(Withings::SCALE, Withings::BLOOD_PRESSURE_MONITOR)
92
92
  user.share(0)
93
93
 
94
- You can handle subscriptions through the API
94
+ You can handle subscriptions through the API (all devices currently known => Scale + Blood Pressure Monitor)
95
95
  user.subscribe_notification('http://foo.bar.com', 'test subscription')
96
+ Specify what devices you are interested
97
+ user.subscribe_notification('http://foo.bar.com', 'test subscription', Withings::SCALE, Withings::BLOOD_PRESSURE_MONITOR)
98
+
96
99
  user.describe_notification('http://foo.bar.com')
97
100
  user.revoke_notification('http://foo.bar.com')
98
101
 
data/lib/withings/user.rb CHANGED
@@ -45,9 +45,12 @@ class Withings::User
45
45
  @gender = params['gender'] == 0 ? :male : params['gender'] == 1 ? :female : nil
46
46
  @fat_method = params['fatmethod']
47
47
  end
48
-
49
- def subscribe_notification(callback_url, description)
50
- connection.get_request('/notify', :action => :subscribe, :callbackurl => callback_url, :comment => description, :appli => (Withings::BLOOD_PRESSURE_MONITOR | Withings::SCALE))
48
+
49
+
50
+ def subscribe_notification(callback_url, description, *devices)
51
+ devices = [Withings::SCALE, Withings::BLOOD_PRESSURE_MONITOR] if Array(devices).empty?
52
+ devices = devices.inject('|'.to_sym)
53
+ connection.get_request('/notify', :action => :subscribe, :callbackurl => callback_url, :comment => description, :appli => devices)
51
54
  end
52
55
 
53
56
  def revoke_notification(callback_url)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{simplificator-withings}
5
- s.version = "0.4.1"
5
+ s.version = "0.4.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pascalbetz"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplificator-withings
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - pascalbetz