nike_v2 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@ module NikeV2
6
6
  'running' => 'Running'
7
7
  }
8
8
 
9
+ TO_KEY_MAP = TO_S_MAP.invert
10
+
9
11
  def initialize(code)
10
12
  @code = code
11
13
  end
@@ -17,5 +19,9 @@ module NikeV2
17
19
  def to_s
18
20
  TO_S_MAP[code.downcase]
19
21
  end
22
+
23
+ def self.code_from_string(string)
24
+ TO_KEY_MAP[string]
25
+ end
20
26
  end
21
27
  end
@@ -13,17 +13,20 @@ module NikeV2
13
13
 
14
14
  private
15
15
  def initialize_data
16
- fuel_data = fetch_data
16
+ summary_data = fetch_data
17
17
  initialization_data = {}
18
- if fuel_data
19
- if fuel_data.has_key?('experienceTypes')
18
+ if summary_data
19
+ if summary_data.has_key?('experienceTypes')
20
20
  initialization_data = {
21
- 'activity_types' => fuel_data['experienceTypes'].collect{|a| ExperienceType.new(a)}
21
+ 'activity_types' => summary_data['experienceTypes'].collect{|a| ExperienceType.new(a)}
22
22
  }
23
23
  end
24
- if fuel_data.has_key?('summaries')
25
- fuel_data['summaries'].each do |data|
26
- initialization_data[data['experienceType'].downcase] = data['records']
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
+ initialization_data[data['experienceType'].downcase][record['recordType']] = record['recordValue']
29
+ end
27
30
  end
28
31
  end
29
32
  end
@@ -1,3 +1,3 @@
1
1
  module NikeV2
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  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.2.7
4
+ version: 0.2.8
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-03-10 00:00:00.000000000 Z
12
+ date: 2013-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty