health_graph 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/health_graph.gemspec +33 -3
- data/lib/health_graph.rb +2 -0
- data/lib/health_graph/configuration.rb +2 -1
- data/lib/health_graph/models/settings.rb +18 -0
- data/lib/health_graph/models/strength_training_activities_feed.rb +24 -0
- data/lib/health_graph/models/strength_training_activity.rb +8 -0
- data/lib/health_graph/models/user.rb +8 -0
- metadata +128 -26
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/health_graph.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "health_graph"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kenny Ma"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-07-17"
|
13
13
|
s.description = "This is a wrapper for RunKeeper Health Graph RESTful API."
|
14
14
|
s.email = "kenny@kennyma.me"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -34,7 +34,10 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/health_graph/models/fitness_activity_update.rb",
|
35
35
|
"lib/health_graph/models/new_fitness_activity.rb",
|
36
36
|
"lib/health_graph/models/profile.rb",
|
37
|
+
"lib/health_graph/models/settings.rb",
|
37
38
|
"lib/health_graph/models/sleep_feed.rb",
|
39
|
+
"lib/health_graph/models/strength_training_activities_feed.rb",
|
40
|
+
"lib/health_graph/models/strength_training_activity.rb",
|
38
41
|
"lib/health_graph/models/user.rb",
|
39
42
|
"lib/health_graph/models/weight_feed.rb",
|
40
43
|
"test/fixtures/background_activities_feed.json",
|
@@ -61,7 +64,7 @@ Gem::Specification.new do |s|
|
|
61
64
|
s.homepage = "http://github.com/kennyma/health_graph"
|
62
65
|
s.licenses = ["MIT"]
|
63
66
|
s.require_paths = ["lib"]
|
64
|
-
s.rubygems_version = "1.8.
|
67
|
+
s.rubygems_version = "1.8.13"
|
65
68
|
s.summary = "Ruby gem for RunKeeper Health Graph API"
|
66
69
|
|
67
70
|
if s.respond_to? :specification_version then
|
@@ -72,6 +75,15 @@ Gem::Specification.new do |s|
|
|
72
75
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
73
76
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
74
77
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
78
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
79
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
80
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
81
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
82
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
83
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
84
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
85
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
86
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
75
87
|
s.add_runtime_dependency(%q<oauth2>, [">= 0.5.2"])
|
76
88
|
s.add_runtime_dependency(%q<faraday>, [">= 0.7.4"])
|
77
89
|
s.add_runtime_dependency(%q<faraday_middleware>, [">= 0.7.8"])
|
@@ -85,6 +97,15 @@ Gem::Specification.new do |s|
|
|
85
97
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
86
98
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
87
99
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
100
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
101
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
102
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
103
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
104
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
105
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
106
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
107
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
108
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
88
109
|
s.add_dependency(%q<oauth2>, [">= 0.5.2"])
|
89
110
|
s.add_dependency(%q<faraday>, [">= 0.7.4"])
|
90
111
|
s.add_dependency(%q<faraday_middleware>, [">= 0.7.8"])
|
@@ -99,6 +120,15 @@ Gem::Specification.new do |s|
|
|
99
120
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
100
121
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
101
122
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
123
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
124
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
125
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
126
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
127
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
128
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
129
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
130
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
131
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
102
132
|
s.add_dependency(%q<oauth2>, [">= 0.5.2"])
|
103
133
|
s.add_dependency(%q<faraday>, [">= 0.7.4"])
|
104
134
|
s.add_dependency(%q<faraday_middleware>, [">= 0.7.8"])
|
data/lib/health_graph.rb
CHANGED
@@ -10,9 +10,11 @@ require 'health_graph/models/profile'
|
|
10
10
|
require 'health_graph/models/weight_feed'
|
11
11
|
require 'health_graph/models/sleep_feed'
|
12
12
|
require 'health_graph/models/fitness_activities_feed'
|
13
|
+
require 'health_graph/models/strength_training_activities_feed'
|
13
14
|
require 'health_graph/models/new_fitness_activity'
|
14
15
|
require 'health_graph/models/fitness_activity_update'
|
15
16
|
require 'health_graph/models/fitness_activity_delete'
|
17
|
+
require 'health_graph/models/settings'
|
16
18
|
|
17
19
|
module HealthGraph
|
18
20
|
extend Configuration
|
@@ -39,7 +39,8 @@ module HealthGraph
|
|
39
39
|
:diabetes_feed => "application/vnd.com.runkeeper.DiabetesFeed+json",
|
40
40
|
:diatetes_measurement => "application/vnd.com.runkeeper.DiabetesMeasurement+json",
|
41
41
|
:records => "application/vnd.com.runkeeper.Records+json",
|
42
|
-
:profile => "application/vnd.com.runkeeper.Profile+json"
|
42
|
+
:profile => "application/vnd.com.runkeeper.Profile+json",
|
43
|
+
:settings => "application/vnd.com.runkeeper.Settings+json"
|
43
44
|
}.freeze
|
44
45
|
|
45
46
|
attr_accessor *VALID_OPTIONS_KEYS
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HealthGraph
|
2
|
+
class Settings
|
3
|
+
include Model
|
4
|
+
|
5
|
+
hash_attr_accessor :distance_units, :weight_units
|
6
|
+
|
7
|
+
def initialize(access_token, path)
|
8
|
+
self.access_token = access_token
|
9
|
+
response = get path, HealthGraph.accept_headers[:settings]
|
10
|
+
self.body = response.body
|
11
|
+
populate_from_hash! self.body
|
12
|
+
end
|
13
|
+
|
14
|
+
def elite?
|
15
|
+
self.body["elite"] == "true"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HealthGraph
|
2
|
+
class StrengthTrainingActivitiesFeed
|
3
|
+
include Model
|
4
|
+
|
5
|
+
hash_attr_accessor :items, :next, :previous, :size
|
6
|
+
|
7
|
+
class Item
|
8
|
+
include Model
|
9
|
+
|
10
|
+
hash_attr_accessor :start_time, :uri
|
11
|
+
|
12
|
+
def initialize(hash)
|
13
|
+
populate_from_hash! hash
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(access_token, path, params = {})
|
18
|
+
self.access_token = access_token
|
19
|
+
response = get path, HealthGraph.accept_headers[:strength_training_activity_feed], params
|
20
|
+
self.body = response.body
|
21
|
+
populate_from_hash! self.body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -15,6 +15,10 @@ module HealthGraph
|
|
15
15
|
HealthGraph::Profile.new self.access_token, self.body["profile"]
|
16
16
|
end
|
17
17
|
|
18
|
+
def settings
|
19
|
+
HealthGraph::Settings.new self.access_token, self.body["settings"]
|
20
|
+
end
|
21
|
+
|
18
22
|
def weight
|
19
23
|
HealthGraph::WeightFeed.new self.access_token, self.body["weight"]
|
20
24
|
end
|
@@ -38,5 +42,9 @@ module HealthGraph
|
|
38
42
|
def fitness_activity_delete params
|
39
43
|
HealthGraph::FitnessActivityDelete.new self.access_token, params
|
40
44
|
end
|
45
|
+
|
46
|
+
def strength_training_activities params = {}
|
47
|
+
HealthGraph::StrengthTrainingActivitiesFeed.new self.access_token, self.body["strength_training_activities"], params
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: health_graph
|
16
|
-
requirement: &
|
16
|
+
requirement: &70188456321720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70188456321720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &70188456321220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70188456321220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: simplecov
|
38
|
-
requirement: &
|
38
|
+
requirement: &70188456320740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70188456320740
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70188456320200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,109 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70188456320200
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: shoulda
|
60
|
+
requirement: &70188456319680 !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: *70188456319680
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: &70188456319180 !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: *70188456319180
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jeweler
|
82
|
+
requirement: &70188456318560 !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: *70188456318560
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: shoulda
|
93
|
+
requirement: &70188456317920 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70188456317920
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &70188456316960 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70188456316960
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: jeweler
|
115
|
+
requirement: &70188456309880 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70188456309880
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: shoulda
|
126
|
+
requirement: &70188456309140 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70188456309140
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: simplecov
|
137
|
+
requirement: &70188456308440 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70188456308440
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: jeweler
|
148
|
+
requirement: &70188456307540 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *70188456307540
|
58
157
|
- !ruby/object:Gem::Dependency
|
59
158
|
name: oauth2
|
60
|
-
requirement: &
|
159
|
+
requirement: &70188456306260 !ruby/object:Gem::Requirement
|
61
160
|
none: false
|
62
161
|
requirements:
|
63
162
|
- - ! '>='
|
@@ -65,10 +164,10 @@ dependencies:
|
|
65
164
|
version: 0.5.2
|
66
165
|
type: :runtime
|
67
166
|
prerelease: false
|
68
|
-
version_requirements: *
|
167
|
+
version_requirements: *70188456306260
|
69
168
|
- !ruby/object:Gem::Dependency
|
70
169
|
name: faraday
|
71
|
-
requirement: &
|
170
|
+
requirement: &70188456304780 !ruby/object:Gem::Requirement
|
72
171
|
none: false
|
73
172
|
requirements:
|
74
173
|
- - ! '>='
|
@@ -76,10 +175,10 @@ dependencies:
|
|
76
175
|
version: 0.7.4
|
77
176
|
type: :runtime
|
78
177
|
prerelease: false
|
79
|
-
version_requirements: *
|
178
|
+
version_requirements: *70188456304780
|
80
179
|
- !ruby/object:Gem::Dependency
|
81
180
|
name: faraday_middleware
|
82
|
-
requirement: &
|
181
|
+
requirement: &70188456303740 !ruby/object:Gem::Requirement
|
83
182
|
none: false
|
84
183
|
requirements:
|
85
184
|
- - ! '>='
|
@@ -87,10 +186,10 @@ dependencies:
|
|
87
186
|
version: 0.7.8
|
88
187
|
type: :runtime
|
89
188
|
prerelease: false
|
90
|
-
version_requirements: *
|
189
|
+
version_requirements: *70188456303740
|
91
190
|
- !ruby/object:Gem::Dependency
|
92
191
|
name: hashie
|
93
|
-
requirement: &
|
192
|
+
requirement: &70188456302680 !ruby/object:Gem::Requirement
|
94
193
|
none: false
|
95
194
|
requirements:
|
96
195
|
- - ! '>='
|
@@ -98,10 +197,10 @@ dependencies:
|
|
98
197
|
version: '1.2'
|
99
198
|
type: :runtime
|
100
199
|
prerelease: false
|
101
|
-
version_requirements: *
|
200
|
+
version_requirements: *70188456302680
|
102
201
|
- !ruby/object:Gem::Dependency
|
103
202
|
name: webmock
|
104
|
-
requirement: &
|
203
|
+
requirement: &70188456301980 !ruby/object:Gem::Requirement
|
105
204
|
none: false
|
106
205
|
requirements:
|
107
206
|
- - ! '>='
|
@@ -109,10 +208,10 @@ dependencies:
|
|
109
208
|
version: 1.7.6
|
110
209
|
type: :runtime
|
111
210
|
prerelease: false
|
112
|
-
version_requirements: *
|
211
|
+
version_requirements: *70188456301980
|
113
212
|
- !ruby/object:Gem::Dependency
|
114
213
|
name: shoulda
|
115
|
-
requirement: &
|
214
|
+
requirement: &70188456301360 !ruby/object:Gem::Requirement
|
116
215
|
none: false
|
117
216
|
requirements:
|
118
217
|
- - ! '>='
|
@@ -120,10 +219,10 @@ dependencies:
|
|
120
219
|
version: '0'
|
121
220
|
type: :development
|
122
221
|
prerelease: false
|
123
|
-
version_requirements: *
|
222
|
+
version_requirements: *70188456301360
|
124
223
|
- !ruby/object:Gem::Dependency
|
125
224
|
name: simplecov
|
126
|
-
requirement: &
|
225
|
+
requirement: &70188456300580 !ruby/object:Gem::Requirement
|
127
226
|
none: false
|
128
227
|
requirements:
|
129
228
|
- - ! '>='
|
@@ -131,10 +230,10 @@ dependencies:
|
|
131
230
|
version: '0'
|
132
231
|
type: :development
|
133
232
|
prerelease: false
|
134
|
-
version_requirements: *
|
233
|
+
version_requirements: *70188456300580
|
135
234
|
- !ruby/object:Gem::Dependency
|
136
235
|
name: jeweler
|
137
|
-
requirement: &
|
236
|
+
requirement: &70188456299740 !ruby/object:Gem::Requirement
|
138
237
|
none: false
|
139
238
|
requirements:
|
140
239
|
- - ! '>='
|
@@ -142,7 +241,7 @@ dependencies:
|
|
142
241
|
version: '0'
|
143
242
|
type: :development
|
144
243
|
prerelease: false
|
145
|
-
version_requirements: *
|
244
|
+
version_requirements: *70188456299740
|
146
245
|
description: This is a wrapper for RunKeeper Health Graph RESTful API.
|
147
246
|
email: kenny@kennyma.me
|
148
247
|
executables: []
|
@@ -168,7 +267,10 @@ files:
|
|
168
267
|
- lib/health_graph/models/fitness_activity_update.rb
|
169
268
|
- lib/health_graph/models/new_fitness_activity.rb
|
170
269
|
- lib/health_graph/models/profile.rb
|
270
|
+
- lib/health_graph/models/settings.rb
|
171
271
|
- lib/health_graph/models/sleep_feed.rb
|
272
|
+
- lib/health_graph/models/strength_training_activities_feed.rb
|
273
|
+
- lib/health_graph/models/strength_training_activity.rb
|
172
274
|
- lib/health_graph/models/user.rb
|
173
275
|
- lib/health_graph/models/weight_feed.rb
|
174
276
|
- test/fixtures/background_activities_feed.json
|