nike_v2 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nike_v2/activities.rb +20 -4
- data/lib/nike_v2/activity.rb +12 -1
- data/lib/nike_v2/metric.rb +37 -0
- data/lib/nike_v2/metrics.rb +38 -0
- data/lib/nike_v2/resource.rb +17 -9
- data/lib/nike_v2.rb +4 -1
- data/nike_v2.gemspec +1 -0
- data/spec/fixtures/nike_api_cassettes/activity.yml +1 -1
- data/spec/nike_v2/metric_spec.rb +29 -0
- data/spec/nike_v2/metrics_spec.rb +22 -0
- data/spec/nike_v2/summary_spec.rb +2 -2
- metadata +24 -2
data/lib/nike_v2/activities.rb
CHANGED
@@ -4,7 +4,7 @@ module NikeV2
|
|
4
4
|
include Enumerable
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
-
def_delegators :@activities_array, :[]=, :<<, :[], :count, :length, :each
|
7
|
+
def_delegators :@activities_array, :[]=, :<<, :[], :count, :length, :each, :first, :last
|
8
8
|
def_delegator :@person, :access_token
|
9
9
|
|
10
10
|
API_URL = '/me/sport/activities'
|
@@ -16,10 +16,26 @@ module NikeV2
|
|
16
16
|
|
17
17
|
#TODO: make it pass blocks
|
18
18
|
activities = fetch_data
|
19
|
-
activities.delete('data')
|
20
|
-
|
21
|
-
end
|
19
|
+
build_activities(activities.delete('data'))
|
20
|
+
|
22
21
|
super(activities)
|
23
22
|
end
|
23
|
+
|
24
|
+
def fetch_more
|
25
|
+
unless self.paging['next'].blank?
|
26
|
+
url, query = self.paging['next'].match(/^(.*?)\?(.*)$/)[1,2]
|
27
|
+
query = query.split(/&/).inject({}){|h,item| k, v = item.split(/\=/); h[k] = v;h}
|
28
|
+
activities = fetch_data(url, {query: query})
|
29
|
+
build_activities(activities.delete('data'))
|
30
|
+
self.paging = activities.delete['paging']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def build_activities(data)
|
36
|
+
data.each do |activity|
|
37
|
+
self << NikeV2::Activity.new({:person => self}.merge(activity))
|
38
|
+
end
|
39
|
+
end
|
24
40
|
end
|
25
41
|
end
|
data/lib/nike_v2/activity.rb
CHANGED
@@ -15,11 +15,22 @@ module NikeV2
|
|
15
15
|
@gps_data ||= NikeV2::GpsData.new(:activity => self)
|
16
16
|
end
|
17
17
|
|
18
|
+
def metrics
|
19
|
+
@metrics
|
20
|
+
end
|
21
|
+
|
18
22
|
def load_data
|
19
|
-
|
23
|
+
data = fetch_data
|
24
|
+
@metrics = NikeV2::Metrics.new(self, data.delete('metrics'))
|
25
|
+
|
26
|
+
set_attributes(data)
|
20
27
|
true
|
21
28
|
end
|
22
29
|
|
30
|
+
def started_at
|
31
|
+
@started_at ||= Time.parse(self.start_time)
|
32
|
+
end
|
33
|
+
|
23
34
|
private
|
24
35
|
def api_url
|
25
36
|
API_URL + "/#{self.activity_id}"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module NikeV2
|
2
|
+
class Metric
|
3
|
+
|
4
|
+
def initialize(activity, data)
|
5
|
+
@activity = activity
|
6
|
+
@unit = data['intervalUnit']
|
7
|
+
@type = data ['metricType']
|
8
|
+
@values = data['values']
|
9
|
+
end
|
10
|
+
|
11
|
+
def type
|
12
|
+
@type
|
13
|
+
end
|
14
|
+
|
15
|
+
def values
|
16
|
+
@values
|
17
|
+
end
|
18
|
+
|
19
|
+
def total
|
20
|
+
@total ||= values.inject(:+)
|
21
|
+
end
|
22
|
+
|
23
|
+
def total_during(start, stop)
|
24
|
+
during(start, stop).collect(&:to_i).inject(:+)
|
25
|
+
end
|
26
|
+
|
27
|
+
def during(start, stop)
|
28
|
+
@values[time_to_index(start)..time_to_index(stop)]
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def time_to_index(time)
|
33
|
+
difference = time.to_i - @activity.started_at.to_i
|
34
|
+
difference.seconds.to.send(@unit.downcase).to_s.to_i
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
def initialize(activity, data_set)
|
10
|
+
@activity = activity
|
11
|
+
@metrics_array = []
|
12
|
+
build_metrics(data_set)
|
13
|
+
end
|
14
|
+
|
15
|
+
def fuel_points
|
16
|
+
@fuel_points ||= sum_of_type('FUELPOINTS')
|
17
|
+
end
|
18
|
+
|
19
|
+
def calories
|
20
|
+
@fuel_points ||= sum_of_type('CALORIES')
|
21
|
+
end
|
22
|
+
|
23
|
+
def distance
|
24
|
+
@fuel_points ||= sum_of_type('DISTANCE')
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def build_metrics(data_set)
|
29
|
+
data_set.each do |metric|
|
30
|
+
self << NikeV2::Metric.new(@activity, metric)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def sum_of_type(type)
|
35
|
+
@metrics_array.select{|m| m.type == type}.collect(&:total).inject(:+) || 0.00
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/nike_v2/resource.rb
CHANGED
@@ -8,29 +8,37 @@ module NikeV2
|
|
8
8
|
super(attributes)
|
9
9
|
end
|
10
10
|
|
11
|
-
def fetch_data
|
12
|
-
|
11
|
+
def fetch_data(*args)
|
12
|
+
args << api_url if args.empty?
|
13
|
+
get(*args).parsed_response
|
13
14
|
end
|
14
15
|
|
15
16
|
def get(*args, &block)
|
16
|
-
|
17
|
-
query = { 'access_token' => access_token }
|
18
|
-
headers = { 'Accept' => 'application/json', 'appid' => app_id }
|
19
|
-
options = { query: query, headers: headers }
|
20
|
-
args << options
|
21
|
-
end
|
17
|
+
build_options(args)
|
22
18
|
self.class.get(*args, &block)
|
23
19
|
end
|
24
20
|
|
25
21
|
private
|
26
22
|
|
23
|
+
def build_options(args)
|
24
|
+
query = { 'access_token' => access_token }
|
25
|
+
headers = { 'Accept' => 'application/json', 'appid' => app_id }
|
26
|
+
options = { query: query, headers: headers }
|
27
|
+
if has_options?(args)
|
28
|
+
args[-1] = options.merge(args.last)
|
29
|
+
else
|
30
|
+
args << options
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
27
35
|
def app_id
|
28
36
|
#TODO: make this a config yaml
|
29
37
|
'nike'
|
30
38
|
end
|
31
39
|
|
32
40
|
def has_options?(args)
|
33
|
-
args.last.
|
41
|
+
args.last.is_a?(Hash)
|
34
42
|
end
|
35
43
|
|
36
44
|
def api_url
|
data/lib/nike_v2.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'forwardable'
|
3
|
+
require 'alchemist'
|
3
4
|
require 'ext/core_ext'
|
4
5
|
require 'nike_v2/base'
|
5
6
|
require 'nike_v2/experience_type'
|
@@ -9,7 +10,9 @@ require 'nike_v2/activities'
|
|
9
10
|
require 'nike_v2/activity'
|
10
11
|
require 'nike_v2/summary'
|
11
12
|
require 'nike_v2/gps_data'
|
13
|
+
require 'nike_v2/metrics'
|
14
|
+
require 'nike_v2/metric'
|
12
15
|
|
13
16
|
module NikeV2
|
14
|
-
VERSION = '0.1.
|
17
|
+
VERSION = '0.1.2'
|
15
18
|
end
|
data/nike_v2.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.require_paths = ['lib']
|
18
18
|
|
19
19
|
s.add_runtime_dependency 'httparty', '>= 0.10.0'
|
20
|
+
s.add_runtime_dependency 'alchemist', '>= 0.1.3'
|
20
21
|
|
21
22
|
s.add_development_dependency 'factory_girl', '~> 4.2.0'
|
22
23
|
s.add_development_dependency 'rake', '~> 10.0.3'
|
@@ -30,7 +30,7 @@ http_interactions:
|
|
30
30
|
- keep-alive
|
31
31
|
body:
|
32
32
|
encoding: US-ASCII
|
33
|
-
string: ! '{ "activityId": "91b501dc-4a38-44aa-b537-6095418713d8", "calories": 257, "fuel": 662, "distance": 3.1317999362945557, "steps": 10, "duration": "0:14:31.000", "activityType": "RUN", "startTime": "2011-08-11T02:44:39Z", "activityTimeZone": "GMT-08:00", "status": "COMPLETE", "deviceType": "SPORTWATCH", "tags": [ { "tagType": "NOTE", "value": "text string" }, { "tagType": "COURT", "value": "DUNK" }, { "tagType": "TERRAIN", "value": "TRAIL" }, { "tagType": "EMOTION", "value": "HAPPY" }, { "tagType": "SHOES", "value": "AirMax" }, { "tagType": "WEATHER", "value": "RAINY" } ], "metrics": [ { "intervalMetric": 10, "intervalUnit": "SEC", "metricType": "DISTANCE", "values": [ 0.0299, 0.0562, 0.0794, 0.114, 3.0967, 3.1296 ] } ] }'
|
33
|
+
string: ! '{ "activityId": "91b501dc-4a38-44aa-b537-6095418713d8", "calories": 257, "fuel": 662, "distance": 3.1317999362945557, "steps": 10, "duration": "0:14:31.000", "activityType": "RUN", "startTime": "2011-08-11T02:44:39Z", "activityTimeZone": "GMT-08:00", "status": "COMPLETE", "deviceType": "SPORTWATCH", "tags": [ { "tagType": "NOTE", "value": "text string" }, { "tagType": "COURT", "value": "DUNK" }, { "tagType": "TERRAIN", "value": "TRAIL" }, { "tagType": "EMOTION", "value": "HAPPY" }, { "tagType": "SHOES", "value": "AirMax" }, { "tagType": "WEATHER", "value": "RAINY" } ], "metrics": [ { "intervalMetric": 10, "intervalUnit": "SEC", "metricType": "DISTANCE", "values": [ 0.0299, 0.0562, 0.0794, 0.114, 3.0967, 3.1296 ] }, { "intervalMetric": 1, "intervalUnit": "MIN", "metricType": "FUEL", "values": [ "21", "8", "21", "3", "19", "19", "8", "25", "8", "3", "16", "14", "23", "26", "28", "24", "14", "19", "16", "0", "2", "20", "22", "3", "21", "7", "24", "26", "25", "8", "21", "22", "20", "6", "22", "17", "15", "2", "22", "4", "18", "16", "9", "10", "0", "24", "7", "25", "9", "8", "15", "3", "7", "12", "22", "18", "13", "28", "15", "0", "22", "24", "16", "14", "12", "14", "18", "5", "8", "24", "9", "18", "25", "15", "6", "3", "28", "5", "8", "6", "19", "6", "18", "18", "21", "24", "26", "0", "24", "12", "5", "11", "3", "12", "22", "22", "22", "23", "1", "1", "16", "6", "26", "14", "11", "23", "15", "4", "13", "2", "3", "28", "2", "7", "9", "0", "4", "25", "18", "10", "25", "3", "23", "27", "10", "20", "2", "15", "23", "1", "21", "14", "4", "1", "26", "20", "20", "28", "24", "18", "9", "24", "23", "16", "0", "11", "14", "14", "12", "15", "12", "3", "14", "21", "17", "22", "28", "28", "27", "21", "15", "25", "24", "2", "25", "21", "20", "3", "20", "6", "2", "6", "1", "25", "20", "20", "23", "9", "8", "17", "5", "15", "2", "15", "21", "21", "25", "13", "10", "22", "10", "6", "25", "27", "6", "24", "0", "20", "27", "12", "23", "7", "20", "11", "15", "23", "20", "21", "24", "25", "21", "20", "12", "7", "16", "24", "16", "26", "15", "16", "15", "7", "11", "17", "26", "24", "17", "25", "12", "23", "12", "5", "23", "7", "11", "1", "6", "14", "18", "14", "8", "11", "13", "0", "17", "15", "26", "25", "0", "17", "27", "6", "14", "19", "16", "12", "15", "1", "12", "15", "12", "0", "7", "16", "12", "22", "10", "14", "27", "9", "6", "16", "4", "18", "18", "19", "16", "7", "12", "12", "4", "17", "25", "20", "28", "7", "9", "5", "2", "14", "7", "28", "11", "11", "3", "25", "13", "1", "15", "3", "27", "8", "6", "17", "24", "6", "19", "25", "2", "3", "12", "2", "18", "15", "25", "25", "26", "28", "22", "18", "0", "0", "24", "25", "7", "2", "28", "0", "21", "23", "26", "25", "7", "22", "27", "11", "4", "15", "12", "3", "2", "26", "6", "13", "26", "1", "18", "14", "22", "9", "9", "1", "19", "12", "27", "10", "6", "6", "25", "1", "21", "21", "6", "20", "22", "1", "3", "8", "1", "7", "11", "10", "16", "5", "14", "19", "21", "23", "3", "3", "4", "10", "20", "6", "1", "19", "0", "8", "28", "10", "19", "14", "17", "3", "13", "7", "24", "26", "8", "1", "27", "5", "2", "9", "13", "0", "20", "9", "23", "13", "27", "13", "1", "2", "12", "13", "17", "20", "21", "22", "1", "13", "14", "2", "16", "12", "9", "19", "10", "2", "28", "27", "23", "25", "27", "9", "28", "25", "3", "28", "13", "18", "3", "25", "25", "3", "10", "20", "5", "27", "14", "24", "10", "4", "11", "16", "11", "6", "16", "24", "20", "14", "23", "8", "13", "5", "25", "7", "11", "23", "10", "0", "27", "1", "22", "28", "26", "13", "16", "23", "13", "2", "22", "23", "25", "2", "7", "1", "9", "28", "13", "24", "16", "1", "24", "4", "21", "25", "12", "7", "26", "0", "1", "13", "23", "12", "2", "4", "1", "12", "23", "12", "21", "21", "2", "10", "5", "16", "1", "17", "1", "2", "4", "1", "27", "14", "12", "13", "27", "28", "8", "21", "18", "6", "15", "10", "12", "7", "0", "26", "4", "12", "1", "1", "20", "22", "10", "19", "27", "16", "7", "24", "14", "25", "0", "10", "5", "5", "8", "5", "3", "16", "15", "6", "7", "5", "14", "6", "11", "18", "17", "11", "7", "7", "2", "24", "11", "13", "17", "26", "6", "13", "9", "16", "18", "3", "12", "14", "3", "13", "11", "20", "8", "18", "12", "0", "3", "22", "17", "4", "0", "8", "3", "21", "28", "5", "14", "8", "20", "17", "24", "15", "7", "1", "1", "27", "12", "12", "4", "4", "27", "25", "0", "5", "9", "2", "9", "26", "13", "11", "9", "21", "14", "27", "28", "25", "10", "17", "5", "18", "10", "3", "13", "14", "28", "9", "9", "22", "20", "0", "28", "25", "25", "14", "18", "7", "28", "28", "16", "13", "2", "21", "24", "19", "16", "27", "5", "9", "22", "11", "24", "24", "12", "18", "10", "6", "2", "18", "8", "27", "8", "10", "5", "2", "7", "21", "4", "7", "13", "27", "20", "25", "19", "4", "9", "28", "11", "15", "13", "17", "7", "12", "27", "6", "3", "15", "22", "14", "2", "17", "21", "16", "17", "7", "10", "24", "26", "16", "11", "27", "11", "28", "25", "27", "9", "3", "19", "20", "23", "4", "24", "27", "14", "20", "15", "15", "3", "22", "18", "9", "17", "22", "16", "28", "1", "14", "13", "8", "21", "25", "16", "24", "16", "15", "16", "13", "17", "8", "24", "0", "19", "5", "18", "18", "3", "16", "18", "10", "22", "3", "24", "27", "15", "28", "9", "17", "24", "15", "3", "15", "16", "24", "25", "25", "28", "20", "10", "19", "1", "12", "12", "28", "23", "17", "24", "4", "10", "25", "19", "25", "5", "5", "10", "23", "17", "18", "17", "4", "5", "26", "27", "6", "9", "23", "3", "5", "12", "21", "22", "7", "4", "22", "10", "4", "14", "23", "9", "20", "26", "2", "5", "21", "4", "11", "18", "19", "14", "21", "16", "9", "13", "0", "14", "19", "14", "2", "10", "9", "4", "23", "8", "0", "10", "12", "24", "6", "3", "1", "20", "28", "24", "11", "5", "14", "23", "0", "20", "24", "4", "6", "5", "21", "13", "5", "28", "9", "11", "5", "12", "1", "10", "8", "24", "23", "28", "14", "2", "2", "10", "3", "21", "23", "2", "0", "12", "20", "20", "17", "18", "27", "20", "0", "27", "28", "11", "15", "5", "0", "1", "4", "3", "21", "22", "22", "22", "1", "7", "19", "8", "6", "11", "5", "19", "16", "6", "11", "20", "23", "5", "25", "27", "16", "5", "18", "17", "18", "25", "11", "25", "5", "16", "13", "16", "8", "7", "0", "13", "27", "14", "20", "26", "26", "11", "12", "16", "25", "6", "24", "16", "20", "26", "14", "22", "16", "12", "21", "23", "15", "20", "24", "23", "14", "10", "1", "11", "0", "16", "15", "9", "24", "14", "11", "9", "21", "18", "13", "26", "4", "16", "7", "16", "14", "11", "6", "13", "2", "6", "19", "21", "4", "4", "14", "22", "28", "23", "1", "2", "11", "24", "13", "20", "7", "28", "15", "6", "14", "25", "5", "21", "17", "25", "23", "18", "4", "11", "28", "5", "24", "19", "17", "4", "1", "1", "9", "15", "16", "12", "26", "4", "12", "21", "9", "11", "4", "19", "13", "25", "11", "13", "3", "10", "13", "22", "21", "22", "5", "18", "9", "18", "26", "15", "9", "12", "3", "27", "25", "19", "11", "28", "23", "19", "2", "16", "18", "21", "26", "28", "25", "18", "23", "23", "5", "22", "13", "15", "12", "24", "25", "20", "9", "16", "13", "21", "15", "17", "25", "11", "21", "21", "13", "25", "24", "26", "12", "1", "28", "6", "19", "19", "22", "15", "9", "0", "16", "0", "4", "8", "4", "8", "7", "21", "23", "15", "19", "5", "13", "19", "19", "22", "14", "8", "2", "4", "15", "27", "19", "21", "27", "1", "7", "5", "15", "15", "6", "25", "11", "7", "19", "17", "17", "3", "10", "26", "1", "25", "6", "0", "20", "0", "23", "20", "0", "13", "27", "2", "12", "4", "16", "13", "22", "19", "15", "11", "27", "21", "26", "26", "9", "8", "24", "10", "20", "21", "7", "17", "28", "21", "19", "3", "21", "7", "9", "21", "6", "13", "26", "20", "6", "7", "4", "0", "7", "17", "12", "21", "12", "14", "17", "21", "4", "12", "8", "20", "2", "4", "6", "23", "27", "16", "16", "19", "10", "14", "9", "8", "14", "18", "19", "22", "21", "24", "0", "14", "15", "17", "10", "17", "28", "27", "26", "16", "10", "14", "6", "25", "20", "22", "26", "5", "0", "26", "1", "16", "4", "1", "13", "24", "9", "25", "19", "26", "16", "27", "28", "5", "8", "27", "9", "16", "24", "2", "3", "23", "15", "10", "17", "11", "24", "1", "2", "19", "5", "25", "27", "16", "17", "27", "15", "15", "27", "8", "2", "7", "25", "14", "3", "12", "16", "17", "20", "19", "9", "11", "1", "22", "13", "7", "7", "21", "18", "15", "14", "18", "23", "5", "11", "17", "15", "7", "17", "17", "15", "16", "17", "4", "10", "21", "13", "25", "0", "17", "17", "5", "15", "27", "25", "24", "5", "0", "18", "8", "6", "25", "25", "20", "27", "21", "25", "3", "5", "0", "13", "6", "7", "9", "7", "19", "13", "13", "4", "24", "0", "23", "17", "0", "7", "1", "16", "4", "21", "10", "23", "6", "12", "21", "1", "5", "11", "25", "8", "15", "26", "3", "2", "0", "22", "16", "8", "19", "16", "2", "9", "28", "14", "9", "15", "1", "8", "18", "9", "4", "9", "19", "18", "16", "28", "4", "10", "23", "22", "9", "21", "25", "8", "9", "16", "16", "21", "18", "8", "20", "17", "3", "15", "23", "16", "24", "10", "10", "28", "27", "18", "4", "25", "22", "19", "11", "2", "23" ] } ] }'
|
34
34
|
http_version:
|
35
35
|
recorded_at: Sun, 20 Jan 2013 04:21:05 GMT
|
36
36
|
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NikeV2::Metric do
|
4
|
+
let(:activity){ build(:activity) }
|
5
|
+
|
6
|
+
describe 'fetch_data' do
|
7
|
+
before do
|
8
|
+
VCR.insert_cassette 'activity', record: :new_episodes
|
9
|
+
activity.load_data
|
10
|
+
end
|
11
|
+
|
12
|
+
after{ VCR.eject_cassette }
|
13
|
+
|
14
|
+
it 'should build the metrics from the activity' do
|
15
|
+
metric = activity.metrics.last
|
16
|
+
metric.type.should == 'FUEL'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should give an array of values during a time range' do
|
20
|
+
metric = activity.metrics.last
|
21
|
+
metric.during(Time.at(activity.started_at.to_i + (60 * 60)), Time.at(activity.started_at.to_i + (60 * 120) - 1)).length.should == 60
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should total the values during a time range' do
|
25
|
+
metric = activity.metrics.last
|
26
|
+
metric.total_during(Time.at(activity.started_at.to_i + (60 * 60)), Time.at(activity.started_at.to_i + (60 * 120))).should == 831
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NikeV2::Metrics do
|
4
|
+
let(:activity){ build(:activity) }
|
5
|
+
|
6
|
+
describe 'fetch_data' do
|
7
|
+
before do
|
8
|
+
VCR.insert_cassette 'activity', record: :new_episodes
|
9
|
+
activity.load_data
|
10
|
+
end
|
11
|
+
|
12
|
+
after{ VCR.eject_cassette }
|
13
|
+
|
14
|
+
it 'should build the metrics from the activity' do
|
15
|
+
activity.metrics.length.should == 2
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should sum the metrics of a given type' do
|
19
|
+
activity.metrics.distance.should == 6.5058
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -9,8 +9,8 @@ describe NikeV2::Summary do
|
|
9
9
|
|
10
10
|
it 'should return a Summary of user data' do
|
11
11
|
person.summary.should be_kind_of(NikeV2::Summary)
|
12
|
-
person.summary.
|
13
|
-
person.summary.
|
12
|
+
person.summary.activity_types.collect(&:to_s).include?('Fuel Band').should be_true
|
13
|
+
person.summary.fuelband.should_not be_nil
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nike_v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.10.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: alchemist
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.1.3
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.3
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: factory_girl
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,6 +141,8 @@ files:
|
|
125
141
|
- lib/nike_v2/base.rb
|
126
142
|
- lib/nike_v2/experience_type.rb
|
127
143
|
- lib/nike_v2/gps_data.rb
|
144
|
+
- lib/nike_v2/metric.rb
|
145
|
+
- lib/nike_v2/metrics.rb
|
128
146
|
- lib/nike_v2/person.rb
|
129
147
|
- lib/nike_v2/resource.rb
|
130
148
|
- lib/nike_v2/summary.rb
|
@@ -139,6 +157,8 @@ files:
|
|
139
157
|
- spec/nike_v2/activity_spec.rb
|
140
158
|
- spec/nike_v2/base_spec.rb
|
141
159
|
- spec/nike_v2/gps_data_spec.rb
|
160
|
+
- spec/nike_v2/metric_spec.rb
|
161
|
+
- spec/nike_v2/metrics_spec.rb
|
142
162
|
- spec/nike_v2/person_spec.rb
|
143
163
|
- spec/nike_v2/resource_spec.rb
|
144
164
|
- spec/nike_v2/summary_spec.rb
|
@@ -178,6 +198,8 @@ test_files:
|
|
178
198
|
- spec/nike_v2/activity_spec.rb
|
179
199
|
- spec/nike_v2/base_spec.rb
|
180
200
|
- spec/nike_v2/gps_data_spec.rb
|
201
|
+
- spec/nike_v2/metric_spec.rb
|
202
|
+
- spec/nike_v2/metrics_spec.rb
|
181
203
|
- spec/nike_v2/person_spec.rb
|
182
204
|
- spec/nike_v2/resource_spec.rb
|
183
205
|
- spec/nike_v2/summary_spec.rb
|