simplificator-withings 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/withings/user.rb +11 -9
- data/simplificator-withings.gemspec +1 -1
- metadata +3 -3
data/lib/withings/user.rb
CHANGED
@@ -48,17 +48,15 @@ class Withings::User
|
|
48
48
|
|
49
49
|
|
50
50
|
def subscribe_notification(callback_url, description, *devices)
|
51
|
-
|
52
|
-
devices = devices.inject('|'.to_sym)
|
53
|
-
connection.get_request('/notify', :action => :subscribe, :callbackurl => callback_url, :comment => description, :appli => devices)
|
51
|
+
connection.get_request('/notify', :action => :subscribe, :callbackurl => callback_url, :comment => description, :appli => devices_bitmask(*devices))
|
54
52
|
end
|
55
53
|
|
56
|
-
def revoke_notification(callback_url)
|
57
|
-
connection.get_request('/notify', :action => :revoke, :callbackurl => callback_url)
|
54
|
+
def revoke_notification(callback_url, *devices)
|
55
|
+
connection.get_request('/notify', :action => :revoke, :callbackurl => callback_url, :appli => devices_bitmask(*devices))
|
58
56
|
end
|
59
57
|
|
60
|
-
def describe_notification(callback_url)
|
61
|
-
response = connection.get_request('/notify', :action => :get, :callbackurl => callback_url)
|
58
|
+
def describe_notification(callback_url, *devices)
|
59
|
+
response = connection.get_request('/notify', :action => :get, :callbackurl => callback_url, :appli => devices_bitmask(*devices))
|
62
60
|
Withings::NotificationDescription.new(response.merge(:callbackurl => callback_url))
|
63
61
|
end
|
64
62
|
|
@@ -92,8 +90,7 @@ class Withings::User
|
|
92
90
|
end
|
93
91
|
|
94
92
|
def share(*devices)
|
95
|
-
|
96
|
-
@share = devices.inject('|'.to_sym)
|
93
|
+
@share = devices_bitmask(devices)
|
97
94
|
connection.get_request('/user', :action => :update, :ispublic => @share)
|
98
95
|
end
|
99
96
|
|
@@ -108,6 +105,11 @@ class Withings::User
|
|
108
105
|
|
109
106
|
|
110
107
|
protected
|
108
|
+
|
109
|
+
def devices_bitmask(*devices)
|
110
|
+
devices = [Withings::SCALE, Withings::BLOOD_PRESSURE_MONITOR] if Array(devices).empty?
|
111
|
+
devices.inject('|'.to_sym)
|
112
|
+
end
|
111
113
|
|
112
114
|
def connection
|
113
115
|
@connection ||= Withings::Connection.new(self)
|
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:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- pascalbetz
|