simplificator-withings 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147bfa6804b84781eac7a30dfbdd240008aab378
4
- data.tar.gz: dcc0e0dbcb32340918f6f30257c62390273f1b8f
3
+ metadata.gz: 769a085bda5af732a5506f8cb9c85032dc9e9326
4
+ data.tar.gz: 9b8b0634681dd0de06fb6de6def7c2fa795e0a5b
5
5
  SHA512:
6
- metadata.gz: a3e7d6d8bf35d6bb557dafd028982664764a497e89a96930409bb1670a9108d7c613584a8fbf12686f4a164157c11a03d2011161cc457ad353afa73688c02170
7
- data.tar.gz: 2168a3cb270e6cc1a6a52893211a53847b897695706f2f20d9427909881745ed71ee462c850c1988e874b04e7b3487904b86ee670441fb59cfa55685a1670cae
6
+ metadata.gz: 25ba63cfa4318fc0669f27d55ccc680d53c55b6678eff7abc1f6b012be48f70dbcc26be9ba2fbcc637f786f1ef9c7c3156ae04f00319f5d775e1832481c15f3b
7
+ data.tar.gz: 5633a5deeff0741b06cc70920aaa5771b6c2250246bcff464351cb2251a74a8a5e15d75e706351e406783d3b2b1db4e4425bd28bec8485f5c3834530194f4af3
data/README.rdoc CHANGED
@@ -4,6 +4,10 @@ This is a ruby implementation for the Withings API. Description of the API can b
4
4
 
5
5
  == Versions ==
6
6
 
7
+ === 0.6.9 ===
8
+
9
+ * Added support for activities (thanks to invernizzi)
10
+
7
11
  === 0.6.8 ===
8
12
 
9
13
  * updated README (thanks to jmaddi)
@@ -133,6 +137,9 @@ And finally you can get measurements, after all this is what it's for
133
137
  user.measurement_groups(:measurement_type => MeasurementGroup::TYPE_FAT)
134
138
  user.measurement_groups(:device => Withings::SCALE)
135
139
 
140
+ Since 0.6.9 you can also get activities
141
+ user.get_activities
142
+
136
143
 
137
144
  == Note on keys in hashes
138
145
 
data/lib/withings/user.rb CHANGED
@@ -7,7 +7,7 @@ class Withings::User
7
7
  raise Withings::ApiError.new(2555, 'No user found', '') unless user_data
8
8
  Withings::User.new(user_data.merge({:oauth_token => oauth_token, :oauth_token_secret => oauth_token_secret}))
9
9
  end
10
-
10
+
11
11
  # If you create a user yourself, then the only attributes of interest (required for calls to the API) are 'user_id' and 'oauth_token' and 'oauth_token_secret'
12
12
  def initialize(params)
13
13
  params = params.stringify_keys
@@ -21,7 +21,7 @@ class Withings::User
21
21
  @oauth_token = params['oauth_token']
22
22
  @oauth_token_secret = params['oauth_token_secret']
23
23
  end
24
-
24
+
25
25
  def subscribe_notification(callback_url, description, device = Withings::SCALE)
26
26
  connection.get_request('/notify', :action => :subscribe, :callbackurl => callback_url, :comment => description, :appli => device)
27
27
  end
@@ -45,6 +45,17 @@ class Withings::User
45
45
  end
46
46
 
47
47
 
48
+ # List the activity metrics.
49
+ # Params:
50
+ # - :date
51
+ # - :startdateymd
52
+ # - :enddateymd
53
+ # Either date OR startdateymd AND enddate need to be supplied.
54
+ def get_activities(params = {})
55
+ connection.get_request('/v2/measure', params.merge(:action => :getactivity))
56
+ end
57
+
58
+
48
59
  # list measurement groups
49
60
  # The limit and offset parameters are converted to will_paginate style parameters (:per_page, :page)
50
61
  # - :per_page (default: 100)
@@ -76,10 +87,10 @@ class Withings::User
76
87
  def to_s
77
88
  "[User #{short_name} / #{:user_id}]"
78
89
  end
79
-
90
+
80
91
 
81
92
  protected
82
-
93
+
83
94
  def devices_bitmask(*devices)
84
95
  devices = [Withings::SCALE, Withings::BLOOD_PRESSURE_MONITOR] if Array(devices).empty?
85
96
  devices.inject('|'.to_sym)
@@ -88,5 +99,5 @@ class Withings::User
88
99
  def connection
89
100
  @connection ||= Withings::Connection.new(self)
90
101
  end
91
-
102
+
92
103
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{simplificator-withings}
5
- s.version = "0.6.8"
5
+ s.version = "0.6.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["pascalbetz", 'invernizzi']
8
+ s.authors = ["simplificator", "jmaddi", 'invernizzi']
9
9
  s.date = %q{2011-04-18}
10
10
  s.description = %q{A withings API implementation in ruby. Created for the evita project at evita.ch}
11
11
  s.email = %q{info@simplificator.com}
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplificator-withings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
- - pascalbetz
7
+ - simplificator
8
+ - jmaddi
8
9
  - invernizzi
9
10
  autorequire:
10
11
  bindir: bin