simplificator-withings 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/.gitignore +1 -0
- data/README.rdoc +6 -0
- data/VERSION +1 -1
- data/lib/withings/user.rb +9 -0
- data/sample.rb +4 -4
- metadata +3 -3
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/withings/user.rb
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
class Withings::User
|
2
|
+
|
3
|
+
def self.authenticate(email_or_user_id, password_or_public_key)
|
4
|
+
if email_or_user_id.include?('@')
|
5
|
+
by_email(email_or_user_id, password_or_public_key)
|
6
|
+
else
|
7
|
+
by_user_id(email_or_user_id, password_or_public_key)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
2
11
|
# Authenticate by email and password
|
3
12
|
def self.by_email(email, password)
|
4
13
|
response = Connection.get_request('/account', :action => :getuserslist, :email => email, :hash => auth_hash(email, password))
|
data/sample.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'withings'
|
3
3
|
|
4
4
|
# All classes are name-spaced
|
5
5
|
include Withings
|
6
6
|
|
7
7
|
# A user can be authenticated with email address and password
|
8
|
-
user = User.
|
8
|
+
user = User.authenticate('<YOUR EMAIL ADDRESS>', '<YOUR PASSWORD>')
|
9
9
|
|
10
10
|
# Or you can fetch details if you have the user id and public key
|
11
|
-
user = User.
|
11
|
+
user = User.authenticate('<YOUR USER ID>', '<YOUR PUBLIC KEY>')
|
12
12
|
|
13
13
|
# or if you already have user id and public key, you can create ir yourself
|
14
14
|
user = User.new(:user_id => '<YOUR USER ID>', :public_key => '<YOUR PUBLIC_KEY>')
|
@@ -26,4 +26,4 @@ user.describe_notification('http://foo.bar.com')
|
|
26
26
|
user.revoke_notification('http://foo.bar.com')
|
27
27
|
|
28
28
|
# list measurement groups
|
29
|
-
|
29
|
+
user.measurement_groups(:per_page => 10, :page => 1, :end_at => Time.now).join("\n")
|
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- pascalbetz
|