nike_v2_neura 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
1
+ require 'enumerator'
2
+ module NikeV2
3
+ class Metrics
4
+ include Enumerable
5
+ extend Forwardable
6
+
7
+ def_delegators :@metrics_array, :[]=, :<<, :[], :count, :length, :each, :first, :last
8
+
9
+ METRIC_TYPES = %w(FUEL CALORIES DISTANCE STEPS)
10
+
11
+ def initialize(activity, data_set)
12
+ @activity = activity
13
+ @metrics_array = []
14
+ build_metrics(data_set)
15
+ self
16
+ end
17
+
18
+ METRIC_TYPES.each do |type|
19
+ method_var_name = 'total_' + type.downcase
20
+ instance_variable_set('@' + method_var_name, 0.00)
21
+ define_method(method_var_name){ ivar = instance_variable_get('@' + method_var_name); ivar ||= sum_of_type(type)}
22
+
23
+ define_method(method_var_name + '_during'){|*args| sum_of_type_during(type, *args)}
24
+ end
25
+
26
+ def durations
27
+ @metrics_array.collect(&:duration).sort.first
28
+ end
29
+
30
+ private
31
+ def build_metrics(data_set)
32
+ data_set.each do |metric|
33
+ self << NikeV2::Metric.new(@activity, metric)
34
+ end
35
+ end
36
+
37
+ def sum_of_type(type)
38
+ @metrics_array.select{|m| m.type == type}.collect(&:total).inject(:+) || 0.00
39
+ end
40
+
41
+ def sum_of_type_during(type, *args)
42
+ @metrics_array.select{|m| m.type == type}.collect{|m| m.total_during(*args)}.inject(:+) || 0.00
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,18 @@
1
+ module NikeV2
2
+ class Person < Resource
3
+
4
+ def initialize(attributes = {})
5
+ raise "#{self.class} requires an access_token." unless attributes.keys.include?(:access_token)
6
+ super
7
+ end
8
+
9
+ def summary
10
+ NikeV2::Summary.new(:person => self)
11
+ end
12
+
13
+ def activities(args = {})
14
+ NikeV2::Activities.new(args.merge(:person => self))
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,69 @@
1
+ require 'httparty'
2
+ require 'httparty_sober'
3
+ module NikeV2
4
+ class Resource < Base
5
+ include HTTParty
6
+ include HTTParty::Sober
7
+
8
+ base_uri 'https://api.nike.com'
9
+
10
+ RESP_MSG_INVALID_TOKEN = 'invalid_token'
11
+
12
+ if NikeV2.configuration.cache
13
+ cache NikeV2.configuration.cache
14
+ end
15
+
16
+ def initialize(attributes={})
17
+ super(attributes)
18
+ end
19
+
20
+ def fetch_data(*args)
21
+ args.unshift(api_url)
22
+ resp = get(*args).parsed_response.clone
23
+
24
+ if !resp['error'].nil? && resp['error'] == RESP_MSG_INVALID_TOKEN
25
+ raise "#{self.class} invalid or expired token, can not fetch data from server."
26
+ end
27
+ resp
28
+ end
29
+
30
+ def get(*args, &block)
31
+ build_options(args)
32
+ self.class.send(get_method, *args, &block)
33
+ end
34
+
35
+ private
36
+
37
+ def build_options(args)
38
+ query = has_options?(args) ? args.pop : {}
39
+
40
+ query.merge!('access_token' => access_token)
41
+ headers = { 'Accept' => 'application/json', 'appid' => app_id }
42
+ options = { query: query, headers: headers }
43
+
44
+ args << options
45
+ end
46
+
47
+
48
+ def app_id
49
+ #TODO: make this a config yaml
50
+ 'nike'
51
+ end
52
+
53
+ def has_options?(args)
54
+ args.last.is_a?(Hash)
55
+ end
56
+
57
+ def api_url
58
+ self.class.const_get('API_URL')
59
+ end
60
+
61
+ def get_method
62
+ if NikeV2.configuration.cache
63
+ 'get_with_caching'
64
+ else
65
+ 'get'
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,40 @@
1
+ module NikeV2
2
+ class Summary < Resource
3
+ extend Forwardable
4
+ def_delegator :@person, :access_token
5
+
6
+ API_URL = '/me/sport'
7
+
8
+ def initialize(attributes = {})
9
+ raise "#{self.class} requires a person." unless attributes.keys.include?(:person)
10
+ set_attributes(attributes)
11
+ super(initialize_data)
12
+ end
13
+
14
+ private
15
+ def initialize_data
16
+ summary_data = fetch_data
17
+ initialization_data = {}
18
+ if summary_data
19
+ if summary_data.has_key?('experienceTypes')
20
+ initialization_data = {
21
+ 'activity_types' => summary_data['experienceTypes'].collect{|a| ExperienceType.new(a)}
22
+ }
23
+ end
24
+ if summary_data.has_key?('summaries')
25
+ summary_data['summaries'].each do |data|
26
+ initialization_data[data['experienceType'].downcase] = {}
27
+ data['records'].each do |record|
28
+ if record.is_a?(Hash)
29
+ initialization_data[data['experienceType'].downcase][record['recordType']] = record['recordValue']
30
+ else
31
+ initialization_data[data['experienceType'].downcase][record[0]] = record[1]
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ initialization_data
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module NikeV2
2
+ VERSION = '0.3.7'
3
+ end
data/nike_v2.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/nike_v2/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'nike_v2_neura'
6
+ s.version = NikeV2::VERSION
7
+ s.authors = ["Eric Harrison"]
8
+ s.email = ["eric@rubynooby.com"]
9
+ s.homepage = 'https://github.com/fuelxc/nike_v2'
10
+ s.summary = 'Nike+ API V2 Gem'
11
+ s.description = 'Nike+ API V2 Gem'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ['lib']
17
+
18
+ s.add_runtime_dependency 'httparty', "~> 0.8.3"
19
+ s.add_runtime_dependency "httparty_sober"
20
+ s.add_runtime_dependency 'alchemist'
21
+ s.add_runtime_dependency 'tzinfo'
22
+
23
+ s.add_development_dependency 'factory_girl', '~> 4.2.0'
24
+ s.add_development_dependency 'rake', '~> 10.0.3'
25
+ s.add_development_dependency 'rspec', '~> 2.12.0'
26
+ s.add_development_dependency 'vcr', '~> 2.4.0'
27
+ s.add_development_dependency 'webmock', '~> 1.9.0'
28
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :activity, class: NikeV2::Activity do
3
+ person { FactoryGirl.build(:person)}
4
+ activityId '91b501dc-4a38-44aa-b537-6095418713d8'
5
+ initialize_with { new(person: person, 'activityId' => activityId) }
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ FactoryGirl.define do
2
+ factory :person, class: NikeV2::Person do
3
+ access_token 'foobar'
4
+ initialize_with { new(access_token: access_token) }
5
+ end
6
+ end
@@ -0,0 +1,370 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Appid:
13
+ - nike
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Content-Type:
20
+ - application/json;charset=UTF-8
21
+ Date:
22
+ - Sun, 20 Jan 2013 04:21:04 GMT
23
+ Server:
24
+ - Apache
25
+ X-Swooshlet:
26
+ - app-msp-api-0 prd sin-82-app-msp-api-0
27
+ Content-Length:
28
+ - '340'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"data":[{"activityId":"91b501dc-4a38-44aa-b537-6095418713d8","calories":2475,"fuel":7500,"distance":19.665315,"steps":24975,"duration":"0:01:00.0000","activityType":"ALL_DAY","startTime":"2012-02-26T08:00:00Z","activityTimeZone":"America/Los_Angeles","status":"COMPLETE","deviceType":"FUELBAND","tags":[],"streams":[],"metrics":[]},{"activityId":"8554c3bb-f985-4700-a52d-6235475a10f0","calories":1848,"fuel":5555,"distance":14.6834352,"steps":18648,"duration":"0:01:00.0000","activityType":"ALL_DAY","startTime":"2012-02-25T08:00:00Z","activityTimeZone":"America/Los_Angeles","status":"COMPLETE","deviceType":"FUELBAND","tags":[],"streams":[]},{"activityId":"b7511567-9414-429a-9b7b-40ebc15af985","calories":396,"fuel":1200,"distance":3.1464504,"steps":3996,"duration":"0:01:00.0000","activityType":"ALL_DAY","startTime":"2012-02-24T08:00:00Z","activityTimeZone":"America/Los_Angeles","status":"COMPLETE","deviceType":"FUELBAND","tags":[],"streams":[]},{"activityId":"b87bb409-a618-47ee-a75e-1bb5f8daf9a6","calories":300,"fuel":900,"distance":2.3621999999999996,"steps":3000,"duration":"0:01:00.0000","activityType":"ALL_DAY","startTime":"2012-02-23T08:00:00Z","activityTimeZone":"America/Los_Angeles","status":"COMPLETE","deviceType":"FUELBAND","tags":[],"streams":[]},{"activityId":"6c6eb89c-fa42-49a6-8b04-2596297a7c3a","calories":200,"fuel":600,"distance":1.5748,"steps":2000,"duration":"0:01:00.0000","activityType":"ALL_DAY","startTime":"2012-02-22T08:00:00Z","activityTimeZone":"America/Los_Angeles","status":"COMPLETE","deviceType":"FUELBAND","tags":[],"streams":[]}],"paging":{"next":"/me/sport/activities?access_token=foobar&amp;offset=6&amp;count=5","previous":null}}'
34
+ http_version:
35
+ recorded_at: Sun, 20 Jan 2013 04:21:05 GMT
36
+ - request:
37
+ method: get
38
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar&count=1
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ''
42
+ headers:
43
+ Accept:
44
+ - application/json
45
+ Appid:
46
+ - nike
47
+ response:
48
+ status:
49
+ code: 200
50
+ message: OK
51
+ headers:
52
+ Content-Type:
53
+ - application/json;charset=UTF-8
54
+ Date:
55
+ - Sun, 20 Jan 2013 04:21:04 GMT
56
+ Server:
57
+ - Apache
58
+ X-Swooshlet:
59
+ - app-msp-api-0 prd sin-82-app-msp-api-0
60
+ Content-Length:
61
+ - '340'
62
+ Connection:
63
+ - keep-alive
64
+ body:
65
+ encoding: US-ASCII
66
+ string: ! '{ "data": [ { "activityId": "c3337642-72db-41f7-b4a2-4da4600dfc9f",
67
+ "calories": 581, "fuel": 1653, "distance": 2.0936965942382812, "steps": 2659,
68
+ "duration": "7:02:00.000", "activityType": "ALL_DAY", "startTime": "2013-02-26T07:00:00Z",
69
+ "activityTimeZone": "America/Phoenix", "status": "IN_PROGRESS", "deviceType":
70
+ "FUELBAND", "tags": [], "metrics": [] } ], "paging": { "next": "/me/sport/activities?count=1&access_token=foobar&offset=2"
71
+ } }'
72
+ http_version:
73
+ recorded_at: Wed, 27 Feb 2013 16:18:07 GMT
74
+ - request:
75
+ method: get
76
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar&startDate=2013-01-01
77
+ body:
78
+ encoding: US-ASCII
79
+ string: ''
80
+ headers:
81
+ Accept:
82
+ - application/json
83
+ Appid:
84
+ - nike
85
+ response:
86
+ status:
87
+ code: 200
88
+ message: OK
89
+ headers:
90
+ Content-Type:
91
+ - application/json;charset=UTF-8
92
+ Date:
93
+ - Sun, 20 Jan 2013 04:21:04 GMT
94
+ Server:
95
+ - Apache
96
+ X-Swooshlet:
97
+ - app-msp-api-0 prd sin-82-app-msp-api-0
98
+ Content-Length:
99
+ - '340'
100
+ Connection:
101
+ - keep-alive
102
+ body:
103
+ encoding: US-ASCII
104
+ string: ! '{ "data": [ { "activityId": "c3337642-72db-41f7-b4a2-4da4600dfc9f",
105
+ "calories": 581, "fuel": 1653, "distance": 2.0936965942382812, "steps": 2659,
106
+ "duration": "7:02:00.000", "activityType": "ALL_DAY", "startTime": "2013-01-01T07:00:00Z",
107
+ "activityTimeZone": "America/Phoenix", "status": "IN_PROGRESS", "deviceType":
108
+ "FUELBAND", "tags": [], "metrics": [] } ], "paging": { "next": "/me/sport/activities?startDate=2013-01-01&access_token=foobar&offset=2"
109
+ } }'
110
+ http_version:
111
+ recorded_at: Wed, 27 Feb 2013 16:18:07 GMT
112
+ - request:
113
+ method: get
114
+ uri: https://api.nike.com/me/sport/activities/c3337642-72db-41f7-b4a2-4da4600dfc9f?access_token=foobar
115
+ body:
116
+ encoding: US-ASCII
117
+ string: ''
118
+ headers:
119
+ Accept:
120
+ - application/json
121
+ Appid:
122
+ - nike
123
+ response:
124
+ status:
125
+ code: 200
126
+ message: OK
127
+ headers:
128
+ Content-Type:
129
+ - application/json;charset=UTF-8
130
+ Date:
131
+ - Sun, 20 Jan 2013 04:21:04 GMT
132
+ Server:
133
+ - Apache
134
+ X-Swooshlet:
135
+ - app-msp-api-0 prd sin-82-app-msp-api-0
136
+ Content-Length:
137
+ - '340'
138
+ Connection:
139
+ - keep-alive
140
+ body:
141
+ encoding: US-ASCII
142
+ string: ! '{ "activityId": "91b501dc-4a38-44aa-b537-6095418713d8", "calories":
143
+ 257, "fuel": 662, "distance": 3.1317999362945557, "steps": 10, "duration":
144
+ "0:14:31.000", "activityType": "RUN", "startTime": "2011-08-11T00:00:00Z",
145
+ "activityTimeZone": "GMT-08:00", "status": "COMPLETE", "deviceType": "SPORTWATCH",
146
+ "tags": [ { "tagType": "NOTE", "value": "text string" }, { "tagType": "COURT",
147
+ "value": "DUNK" }, { "tagType": "TERRAIN", "value": "TRAIL" }, { "tagType":
148
+ "EMOTION", "value": "HAPPY" }, { "tagType": "SHOES", "value": "AirMax" },
149
+ { "tagType": "WEATHER", "value": "RAINY" } ], "metrics": [ { "intervalMetric":
150
+ 10, "intervalUnit": "SEC", "metricType": "DISTANCE", "values": [ 0.0299, 0.0562,
151
+ 0.0794, 0.114, 3.0967, 3.1296 ] }, { "intervalMetric": 1, "intervalUnit":
152
+ "MIN", "metricType": "FUEL", "values": [ "21", "8", "21", "3", "19", "19",
153
+ "8", "25", "8", "3", "16", "14", "23", "26", "28", "24", "14", "19", "16",
154
+ "0", "2", "20", "22", "3", "21", "7", "24", "26", "25", "8", "21", "22", "20",
155
+ "6", "22", "17", "15", "2", "22", "4", "18", "16", "9", "10", "0", "24", "7",
156
+ "25", "9", "8", "15", "3", "7", "12", "22", "18", "13", "28", "15", "0", "22",
157
+ "24", "16", "14", "12", "14", "18", "5", "8", "24", "9", "18", "25", "15",
158
+ "6", "3", "28", "5", "8", "6", "19", "6", "18", "18", "21", "24", "26", "0",
159
+ "24", "12", "5", "11", "3", "12", "22", "22", "22", "23", "1", "1", "16",
160
+ "6", "26", "14", "11", "23", "15", "4", "13", "2", "3", "28", "2", "7", "9",
161
+ "0", "4", "25", "18", "10", "25", "3", "23", "27", "10", "20", "2", "15",
162
+ "23", "1", "21", "14", "4", "1", "26", "20", "20", "28", "24", "18", "9",
163
+ "24", "23", "16", "0", "11", "14", "14", "12", "15", "12", "3", "14", "21",
164
+ "17", "22", "28", "28", "27", "21", "15", "25", "24", "2", "25", "21", "20",
165
+ "3", "20", "6", "2", "6", "1", "25", "20", "20", "23", "9", "8", "17", "5",
166
+ "15", "2", "15", "21", "21", "25", "13", "10", "22", "10", "6", "25", "27",
167
+ "6", "24", "0", "20", "27", "12", "23", "7", "20", "11", "15", "23", "20",
168
+ "21", "24", "25", "21", "20", "12", "7", "16", "24", "16", "26", "15", "16",
169
+ "15", "7", "11", "17", "26", "24", "17", "25", "12", "23", "12", "5", "23",
170
+ "7", "11", "1", "6", "14", "18", "14", "8", "11", "13", "0", "17", "15", "26",
171
+ "25", "0", "17", "27", "6", "14", "19", "16", "12", "15", "1", "12", "15",
172
+ "12", "0", "7", "16", "12", "22", "10", "14", "27", "9", "6", "16", "4", "18",
173
+ "18", "19", "16", "7", "12", "12", "4", "17", "25", "20", "28", "7", "9",
174
+ "5", "2", "14", "7", "28", "11", "11", "3", "25", "13", "1", "15", "3", "27",
175
+ "8", "6", "17", "24", "6", "19", "25", "2", "3", "12", "2", "18", "15", "25",
176
+ "25", "26", "28", "22", "18", "0", "0", "24", "25", "7", "2", "28", "0", "21",
177
+ "23", "26", "25", "7", "22", "27", "11", "4", "15", "12", "3", "2", "26",
178
+ "6", "13", "26", "1", "18", "14", "22", "9", "9", "1", "19", "12", "27", "10",
179
+ "6", "6", "25", "1", "21", "21", "6", "20", "22", "1", "3", "8", "1", "7",
180
+ "11", "10", "16", "5", "14", "19", "21", "23", "3", "3", "4", "10", "20",
181
+ "6", "1", "19", "0", "8", "28", "10", "19", "14", "17", "3", "13", "7", "24",
182
+ "26", "8", "1", "27", "5", "2", "9", "13", "0", "20", "9", "23", "13", "27",
183
+ "13", "1", "2", "12", "13", "17", "20", "21", "22", "1", "13", "14", "2",
184
+ "16", "12", "9", "19", "10", "2", "28", "27", "23", "25", "27", "9", "28",
185
+ "25", "3", "28", "13", "18", "3", "25", "25", "3", "10", "20", "5", "27",
186
+ "14", "24", "10", "4", "11", "16", "11", "6", "16", "24", "20", "14", "23",
187
+ "8", "13", "5", "25", "7", "11", "23", "10", "0", "27", "1", "22", "28", "26",
188
+ "13", "16", "23", "13", "2", "22", "23", "25", "2", "7", "1", "9", "28", "13",
189
+ "24", "16", "1", "24", "4", "21", "25", "12", "7", "26", "0", "1", "13", "23",
190
+ "12", "2", "4", "1", "12", "23", "12", "21", "21", "2", "10", "5", "16", "1",
191
+ "17", "1", "2", "4", "1", "27", "14", "12", "13", "27", "28", "8", "21", "18",
192
+ "6", "15", "10", "12", "7", "0", "26", "4", "12", "1", "1", "20", "22", "10",
193
+ "19", "27", "16", "7", "24", "14", "25", "0", "10", "5", "5", "8", "5", "3",
194
+ "16", "15", "6", "7", "5", "14", "6", "11", "18", "17", "11", "7", "7", "2",
195
+ "24", "11", "13", "17", "26", "6", "13", "9", "16", "18", "3", "12", "14",
196
+ "3", "13", "11", "20", "8", "18", "12", "0", "3", "22", "17", "4", "0", "8",
197
+ "3", "21", "28", "5", "14", "8", "20", "17", "24", "15", "7", "1", "1", "27",
198
+ "12", "12", "4", "4", "27", "25", "0", "5", "9", "2", "9", "26", "13", "11",
199
+ "9", "21", "14", "27", "28", "25", "10", "17", "5", "18", "10", "3", "13",
200
+ "14", "28", "9", "9", "22", "20", "0", "28", "25", "25", "14", "18", "7",
201
+ "28", "28", "16", "13", "2", "21", "24", "19", "16", "27", "5", "9", "22",
202
+ "11", "24", "24", "12", "18", "10", "6", "2", "18", "8", "27", "8", "10",
203
+ "5", "2", "7", "21", "4", "7", "13", "27", "20", "25", "19", "4", "9", "28",
204
+ "11", "15", "13", "17", "7", "12", "27", "6", "3", "15", "22", "14", "2",
205
+ "17", "21", "16", "17", "7", "10", "24", "26", "16", "11", "27", "11", "28",
206
+ "25", "27", "9", "3", "19", "20", "23", "4", "24", "27", "14", "20", "15",
207
+ "15", "3", "22", "18", "9", "17", "22", "16", "28", "1", "14", "13", "8",
208
+ "21", "25", "16", "24", "16", "15", "16", "13", "17", "8", "24", "0", "19",
209
+ "5", "18", "18", "3", "16", "18", "10", "22", "3", "24", "27", "15", "28",
210
+ "9", "17", "24", "15", "3", "15", "16", "24", "25", "25", "28", "20", "10",
211
+ "19", "1", "12", "12", "28", "23", "17", "24", "4", "10", "25", "19", "25",
212
+ "5", "5", "10", "23", "17", "18", "17", "4", "5", "26", "27", "6", "9", "23",
213
+ "3", "5", "12", "21", "22", "7", "4", "22", "10", "4", "14", "23", "9", "20",
214
+ "26", "2", "5", "21", "4", "11", "18", "19", "14", "21", "16", "9", "13",
215
+ "0", "14", "19", "14", "2", "10", "9", "4", "23", "8", "0", "10", "12", "24",
216
+ "6", "3", "1", "20", "28", "24", "11", "5", "14", "23", "0", "20", "24", "4",
217
+ "6", "5", "21", "13", "5", "28", "9", "11", "5", "12", "1", "10", "8", "24",
218
+ "23", "28", "14", "2", "2", "10", "3", "21", "23", "2", "0", "12", "20", "20",
219
+ "17", "18", "27", "20", "0", "27", "28", "11", "15", "5", "0", "1", "4", "3",
220
+ "21", "22", "22", "22", "1", "7", "19", "8", "6", "11", "5", "19", "16", "6",
221
+ "11", "20", "23", "5", "25", "27", "16", "5", "18", "17", "18", "25", "11",
222
+ "25", "5", "16", "13", "16", "8", "7", "0", "13", "27", "14", "20", "26",
223
+ "26", "11", "12", "16", "25", "6", "24", "16", "20", "26", "14", "22", "16",
224
+ "12", "21", "23", "15", "20", "24", "23", "14", "10", "1", "11", "0", "16",
225
+ "15", "9", "24", "14", "11", "9", "21", "18", "13", "26", "4", "16", "7",
226
+ "16", "14", "11", "6", "13", "2", "6", "19", "21", "4", "4", "14", "22", "28",
227
+ "23", "1", "2", "11", "24", "13", "20", "7", "28", "15", "6", "14", "25",
228
+ "5", "21", "17", "25", "23", "18", "4", "11", "28", "5", "24", "19", "17",
229
+ "4", "1", "1", "9", "15", "16", "12", "26", "4", "12", "21", "9", "11", "4",
230
+ "19", "13", "25", "11", "13", "3", "10", "13", "22", "21", "22", "5", "18",
231
+ "9", "18", "26", "15", "9", "12", "3", "27", "25", "19", "11", "28", "23",
232
+ "19", "2", "16", "18", "21", "26", "28", "25", "18", "23", "23", "5", "22",
233
+ "13", "15", "12", "24", "25", "20", "9", "16", "13", "21", "15", "17", "25",
234
+ "11", "21", "21", "13", "25", "24", "26", "12", "1", "28", "6", "19", "19",
235
+ "22", "15", "9", "0", "16", "0", "4", "8", "4", "8", "7", "21", "23", "15",
236
+ "19", "5", "13", "19", "19", "22", "14", "8", "2", "4", "15", "27", "19",
237
+ "21", "27", "1", "7", "5", "15", "15", "6", "25", "11", "7", "19", "17", "17",
238
+ "3", "10", "26", "1", "25", "6", "0", "20", "0", "23", "20", "0", "13", "27",
239
+ "2", "12", "4", "16", "13", "22", "19", "15", "11", "27", "21", "26", "26",
240
+ "9", "8", "24", "10", "20", "21", "7", "17", "28", "21", "19", "3", "21",
241
+ "7", "9", "21", "6", "13", "26", "20", "6", "7", "4", "0", "7", "17", "12",
242
+ "21", "12", "14", "17", "21", "4", "12", "8", "20", "2", "4", "6", "23", "27",
243
+ "16", "16", "19", "10", "14", "9", "8", "14", "18", "19", "22", "21", "24",
244
+ "0", "14", "15", "17", "10", "17", "28", "27", "26", "16", "10", "14", "6",
245
+ "25", "20", "22", "26", "5", "0", "26", "1", "16", "4", "1", "13", "24", "9",
246
+ "25", "19", "26", "16", "27", "28", "5", "8", "27", "9", "16", "24", "2",
247
+ "3", "23", "15", "10", "17", "11", "24", "1", "2", "19", "5", "25", "27",
248
+ "16", "17", "27", "15", "15", "27", "8", "2", "7", "25", "14", "3", "12",
249
+ "16", "17", "20", "19", "9", "11", "1", "22", "13", "7", "7", "21", "18",
250
+ "15", "14", "18", "23", "5", "11", "17", "15", "7", "17", "17", "15", "16",
251
+ "17", "4", "10", "21", "13", "25", "0", "17", "17", "5", "15", "27", "25",
252
+ "24", "5", "0", "18", "8", "6", "25", "25", "20", "27", "21", "25", "3", "5",
253
+ "0", "13", "6", "7", "9", "7", "19", "13", "13", "4", "24", "0", "23", "17",
254
+ "0", "7", "1", "16", "4", "21", "10", "23", "6", "12", "21", "1", "5", "11",
255
+ "25", "8", "15", "26", "3", "2", "0", "22", "16", "8", "19", "16", "2", "9",
256
+ "28", "14", "9", "15", "1", "8", "18", "9", "4", "9", "19", "18", "16", "28",
257
+ "4", "10", "23", "22", "9", "21", "25", "8", "9", "16", "16", "21", "18",
258
+ "8", "20", "17", "3", "15", "23", "16", "24", "10", "10", "28", "27", "18",
259
+ "4", "25", "22", "19", "11", "2", "23" ] } ] }'
260
+ http_version:
261
+ recorded_at: Sun, 20 Jan 2013 04:21:05 GMT
262
+ - request:
263
+ method: get
264
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar&count=1&offset=2
265
+ body:
266
+ encoding: US-ASCII
267
+ string: ''
268
+ headers:
269
+ Accept:
270
+ - application/json
271
+ Appid:
272
+ - nike
273
+ response:
274
+ status:
275
+ code: 200
276
+ message: OK
277
+ headers:
278
+ Content-Type:
279
+ - application/json;charset=UTF-8
280
+ Date:
281
+ - Sun, 20 Jan 2013 04:21:04 GMT
282
+ Server:
283
+ - Apache
284
+ X-Swooshlet:
285
+ - app-msp-api-0 prd sin-82-app-msp-api-0
286
+ Content-Length:
287
+ - '340'
288
+ Connection:
289
+ - keep-alive
290
+ body:
291
+ encoding: US-ASCII
292
+ string: ! '{ "data": [ { "activityId": "c3337642-72db-41f7-b4a2-4da4600dfc91",
293
+ "calories": 581, "fuel": 1653, "distance": 2.0936965942382812, "steps": 2659,
294
+ "duration": "7:02:00.000", "activityType": "ALL_DAY", "startTime": "2013-02-26T07:00:00Z",
295
+ "activityTimeZone": "America/Phoenix", "status": "IN_PROGRESS", "deviceType":
296
+ "FUELBAND", "tags": [], "metrics": [] } ], "paging": { "next": "/me/sport/activities?count=1&access_token=foobar&offset=3"
297
+ } }'
298
+ http_version:
299
+ recorded_at: Thu, 14 Mar 2013 00:45:14 GMT
300
+ - request:
301
+ method: get
302
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar&count=1&offset=3
303
+ body:
304
+ encoding: US-ASCII
305
+ string: ''
306
+ headers:
307
+ Accept:
308
+ - application/json
309
+ Appid:
310
+ - nike
311
+ response:
312
+ status:
313
+ code: 200
314
+ message: OK
315
+ headers:
316
+ Content-Type:
317
+ - application/json;charset=UTF-8
318
+ Date:
319
+ - Sun, 20 Jan 2013 04:21:04 GMT
320
+ Server:
321
+ - Apache
322
+ X-Swooshlet:
323
+ - app-msp-api-0 prd sin-82-app-msp-api-0
324
+ Content-Length:
325
+ - '340'
326
+ Connection:
327
+ - keep-alive
328
+ body:
329
+ encoding: US-ASCII
330
+ string: ! '{ "data": [ { "activityId": "c3337642-72db-41f7-b4a2-4da4600dfc92",
331
+ "calories": 581, "fuel": 1653, "distance": 2.0936965942382812, "steps": 2659,
332
+ "duration": "7:02:00.000", "activityType": "ALL_DAY", "startTime": "2013-02-26T07:00:00Z",
333
+ "activityTimeZone": "America/Phoenix", "status": "IN_PROGRESS", "deviceType":
334
+ "FUELBAND", "tags": [], "metrics": [] } ], "paging": { } }'
335
+ http_version:
336
+ recorded_at: Thu, 14 Mar 2013 00:45:14 GMT
337
+ - request:
338
+ method: get
339
+ uri: https://api.nike.com/me/sport/activities?access_token=foobar&count=1&endDate=2013-03-29&startDate=2013-03-29
340
+ body:
341
+ encoding: US-ASCII
342
+ string: ''
343
+ headers:
344
+ Accept:
345
+ - application/json
346
+ Appid:
347
+ - nike
348
+ response:
349
+ status:
350
+ code: 200
351
+ message: OK
352
+ headers:
353
+ Content-Type:
354
+ - application/json;charset=UTF-8
355
+ Date:
356
+ - Sun, 31 Mar 2013 00:42:39 GMT
357
+ Server:
358
+ - Apache
359
+ X-Swooshlet:
360
+ - app-msp-api-0 prd sin-165-app-msp-api-0
361
+ Content-Length:
362
+ - '472'
363
+ Connection:
364
+ - keep-alive
365
+ body:
366
+ encoding: US-ASCII
367
+ string: ! '{"data":[{"activityId":"1b4f5b2c-26c4-45cc-952a-d62c61cf506a","activityType":"ALL_DAY","startTime":"2013-03-30T07:00:00Z","activityTimeZone":"America/Phoenix","status":"NONE","deviceType":"FUELBAND","metricSummary":{"calories":1462,"fuel":4158,"distance":6.641719,"steps":8435,"duration":"8:48:00.000"},"tags":[],"metrics":[]}],"paging":{"next":"/me/sport/activities?count=1&startDate=2013-03-29&endDate=2013-03-29&access_token=foobar&offset=2"}}'
368
+ http_version:
369
+ recorded_at: Sun, 31 Mar 2013 00:42:43 GMT
370
+ recorded_with: VCR 2.4.0