withings-api 0.0.3

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.
Files changed (61) hide show
  1. data/.gitignore +9 -0
  2. data/.simplecov +5 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +7 -0
  5. data/README.rdoc +84 -0
  6. data/Rakefile +14 -0
  7. data/cucumber.yml +2 -0
  8. data/examples/callback_landing.txt +1 -0
  9. data/examples/create_access_token.rb +62 -0
  10. data/features/get_access_token.feature +70 -0
  11. data/features/get_request_token.feature +68 -0
  12. data/features/measure_getmeas_api.feature +16 -0
  13. data/features/step_definitions/api.rb +113 -0
  14. data/features/support/method_mocker.rb +36 -0
  15. data/features/support/world.rb +34 -0
  16. data/lib/withings-api.rb +19 -0
  17. data/lib/withings-api/api_actions.rb +27 -0
  18. data/lib/withings-api/api_response.rb +23 -0
  19. data/lib/withings-api/consts.rb +12 -0
  20. data/lib/withings-api/errors.rb +23 -0
  21. data/lib/withings-api/oauth_actions.rb +94 -0
  22. data/lib/withings-api/oauth_base.rb +121 -0
  23. data/lib/withings-api/query_string.rb +16 -0
  24. data/lib/withings-api/results/measure_getmeas_results.rb +73 -0
  25. data/lib/withings-api/tokens.rb +35 -0
  26. data/lib/withings-api/types.rb +108 -0
  27. data/lib/withings-api/utils.rb +14 -0
  28. data/lib/withings-api/version.rb +5 -0
  29. data/spec/api_actions/measure_getmeas_spec.rb +22 -0
  30. data/spec/measure_getmeas_results_spec.rb +124 -0
  31. data/spec/method_aliaser_spec.rb +96 -0
  32. data/spec/query_string_spec.rb +20 -0
  33. data/spec/spec_helper.rb +30 -0
  34. data/spec/tokens_spec.rb +38 -0
  35. data/spec/types/atttribution_type_spec.rb +15 -0
  36. data/spec/types/category_type_spec.rb +15 -0
  37. data/spec/types/device_type_spec.rb +15 -0
  38. data/spec/types/measurement_type_spec.rb +15 -0
  39. data/spec/withings_api_spec.rb +67 -0
  40. data/test/README +1 -0
  41. data/test/helpers/http_stubber.rb +32 -0
  42. data/test/helpers/method_aliaser.rb +48 -0
  43. data/test/helpers/stubbed_withings_api.rb +41 -0
  44. data/test/http_stub_responses/access_token/invalid.txt +10 -0
  45. data/test/http_stub_responses/access_token/success.txt +11 -0
  46. data/test/http_stub_responses/access_token/unauthorized_token.txt +11 -0
  47. data/test/http_stub_responses/authorization_callback/success.txt +9 -0
  48. data/test/http_stub_responses/measure_getmeas/forbidden.txt +12 -0
  49. data/test/http_stub_responses/measure_getmeas/oauth_error.txt +9 -0
  50. data/test/http_stub_responses/measure_getmeas/success.txt +9 -0
  51. data/test/http_stub_responses/request_token/invalid_consumer_credentials.txt +10 -0
  52. data/test/http_stub_responses/request_token/success.txt +11 -0
  53. data/test/sample_json/measure_getmeas.json +49 -0
  54. data/test/sample_json/notify_get.json +7 -0
  55. data/test/sample_json/notify_list.json +15 -0
  56. data/test/sample_json/notify_revoke.json +3 -0
  57. data/test/sample_json/notify_subscribe.json +3 -0
  58. data/test/sample_json/once_probe.json +1 -0
  59. data/test/sample_json/user_getbyuserid.json +16 -0
  60. data/withings-api.gemspec +32 -0
  61. metadata +220 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "status":0,
3
+ "body":{
4
+ "expires":2147483647,
5
+ "comment":"Your Own Application Description"
6
+ }
7
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "status":0,
3
+ "body":{
4
+ "profiles":[
5
+ {
6
+ "expires":2147483647,
7
+ "comment":"http:\/\/www.withings.com"
8
+ },
9
+ {
10
+ "expires":2147483647,
11
+ "comment":"http:\/\/www.corp.withings.com"
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "status":0
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "status":0
3
+ }
@@ -0,0 +1 @@
1
+ {"status": 0}
@@ -0,0 +1,16 @@
1
+ {
2
+ "status":0,
3
+ "body":{
4
+ "users":[
5
+ {
6
+ "id":29,
7
+ "firstname":"John",
8
+ "lastname":"Doe",
9
+ "shortname":"JON",
10
+ "gender":0,
11
+ "fatmethod":0,
12
+ "birthdate":211629600,
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "withings-api/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "withings-api"
7
+ s.version = Withings::Api::VERSION
8
+ s.authors = ["webmonarch"]
9
+ s.email = ["eric@collectivegenius.net"]
10
+ s.homepage = ""
11
+ s.summary = "A simple Ruby implementation of the Withings API."
12
+ s.description = "A simple Ruby implementation of the Withings API. See http://www.withings.com/en/api/wbsapiv2"
13
+
14
+ s.rubyforge_project = "withings-api"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ s.add_runtime_dependency "oauth", "~> 0.4.5"
23
+ s.add_runtime_dependency "json"
24
+ # s.add_runtime_dependency "rest-client"
25
+
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "rspec"
28
+ s.add_development_dependency "cucumber"
29
+ s.add_development_dependency "capybara"
30
+ s.add_development_dependency "simplecov"
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,220 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: withings-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - webmonarch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: oauth
16
+ requirement: &18468540 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.4.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *18468540
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &18467540 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *18467540
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &18466440 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *18466440
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &18465980 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *18465980
58
+ - !ruby/object:Gem::Dependency
59
+ name: cucumber
60
+ requirement: &18465420 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *18465420
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: &18464840 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *18464840
80
+ - !ruby/object:Gem::Dependency
81
+ name: simplecov
82
+ requirement: &18464320 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *18464320
91
+ description: A simple Ruby implementation of the Withings API. See http://www.withings.com/en/api/wbsapiv2
92
+ email:
93
+ - eric@collectivegenius.net
94
+ executables: []
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - .gitignore
99
+ - .simplecov
100
+ - Gemfile
101
+ - LICENSE
102
+ - README.rdoc
103
+ - Rakefile
104
+ - cucumber.yml
105
+ - examples/callback_landing.txt
106
+ - examples/create_access_token.rb
107
+ - features/get_access_token.feature
108
+ - features/get_request_token.feature
109
+ - features/measure_getmeas_api.feature
110
+ - features/step_definitions/api.rb
111
+ - features/support/method_mocker.rb
112
+ - features/support/world.rb
113
+ - lib/withings-api.rb
114
+ - lib/withings-api/api_actions.rb
115
+ - lib/withings-api/api_response.rb
116
+ - lib/withings-api/consts.rb
117
+ - lib/withings-api/errors.rb
118
+ - lib/withings-api/oauth_actions.rb
119
+ - lib/withings-api/oauth_base.rb
120
+ - lib/withings-api/query_string.rb
121
+ - lib/withings-api/results/measure_getmeas_results.rb
122
+ - lib/withings-api/tokens.rb
123
+ - lib/withings-api/types.rb
124
+ - lib/withings-api/utils.rb
125
+ - lib/withings-api/version.rb
126
+ - spec/api_actions/measure_getmeas_spec.rb
127
+ - spec/measure_getmeas_results_spec.rb
128
+ - spec/method_aliaser_spec.rb
129
+ - spec/query_string_spec.rb
130
+ - spec/spec_helper.rb
131
+ - spec/tokens_spec.rb
132
+ - spec/types/atttribution_type_spec.rb
133
+ - spec/types/category_type_spec.rb
134
+ - spec/types/device_type_spec.rb
135
+ - spec/types/measurement_type_spec.rb
136
+ - spec/withings_api_spec.rb
137
+ - test/README
138
+ - test/helpers/http_stubber.rb
139
+ - test/helpers/method_aliaser.rb
140
+ - test/helpers/stubbed_withings_api.rb
141
+ - test/http_stub_responses/access_token/invalid.txt
142
+ - test/http_stub_responses/access_token/success.txt
143
+ - test/http_stub_responses/access_token/unauthorized_token.txt
144
+ - test/http_stub_responses/authorization_callback/success.txt
145
+ - test/http_stub_responses/measure_getmeas/forbidden.txt
146
+ - test/http_stub_responses/measure_getmeas/oauth_error.txt
147
+ - test/http_stub_responses/measure_getmeas/success.txt
148
+ - test/http_stub_responses/request_token/invalid_consumer_credentials.txt
149
+ - test/http_stub_responses/request_token/success.txt
150
+ - test/sample_json/measure_getmeas.json
151
+ - test/sample_json/notify_get.json
152
+ - test/sample_json/notify_list.json
153
+ - test/sample_json/notify_revoke.json
154
+ - test/sample_json/notify_subscribe.json
155
+ - test/sample_json/once_probe.json
156
+ - test/sample_json/user_getbyuserid.json
157
+ - withings-api.gemspec
158
+ homepage: ''
159
+ licenses: []
160
+ post_install_message:
161
+ rdoc_options: []
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ! '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubyforge_project: withings-api
178
+ rubygems_version: 1.8.11
179
+ signing_key:
180
+ specification_version: 3
181
+ summary: A simple Ruby implementation of the Withings API.
182
+ test_files:
183
+ - features/get_access_token.feature
184
+ - features/get_request_token.feature
185
+ - features/measure_getmeas_api.feature
186
+ - features/step_definitions/api.rb
187
+ - features/support/method_mocker.rb
188
+ - features/support/world.rb
189
+ - spec/api_actions/measure_getmeas_spec.rb
190
+ - spec/measure_getmeas_results_spec.rb
191
+ - spec/method_aliaser_spec.rb
192
+ - spec/query_string_spec.rb
193
+ - spec/spec_helper.rb
194
+ - spec/tokens_spec.rb
195
+ - spec/types/atttribution_type_spec.rb
196
+ - spec/types/category_type_spec.rb
197
+ - spec/types/device_type_spec.rb
198
+ - spec/types/measurement_type_spec.rb
199
+ - spec/withings_api_spec.rb
200
+ - test/README
201
+ - test/helpers/http_stubber.rb
202
+ - test/helpers/method_aliaser.rb
203
+ - test/helpers/stubbed_withings_api.rb
204
+ - test/http_stub_responses/access_token/invalid.txt
205
+ - test/http_stub_responses/access_token/success.txt
206
+ - test/http_stub_responses/access_token/unauthorized_token.txt
207
+ - test/http_stub_responses/authorization_callback/success.txt
208
+ - test/http_stub_responses/measure_getmeas/forbidden.txt
209
+ - test/http_stub_responses/measure_getmeas/oauth_error.txt
210
+ - test/http_stub_responses/measure_getmeas/success.txt
211
+ - test/http_stub_responses/request_token/invalid_consumer_credentials.txt
212
+ - test/http_stub_responses/request_token/success.txt
213
+ - test/sample_json/measure_getmeas.json
214
+ - test/sample_json/notify_get.json
215
+ - test/sample_json/notify_list.json
216
+ - test/sample_json/notify_revoke.json
217
+ - test/sample_json/notify_subscribe.json
218
+ - test/sample_json/once_probe.json
219
+ - test/sample_json/user_getbyuserid.json
220
+ has_rdoc: