nike_v2 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,6 +10,9 @@ Learn more about the Nike+ API at [https://developer.nike.com/](https://develope
10
10
  gem install nike_v2
11
11
  ```
12
12
 
13
+ ### Comming Soon
14
+ Once Nike releases the OAuth api this gem will include the ability to fetch the access token too
15
+
13
16
  ## Examples
14
17
 
15
18
  In order to utilize the Nike+ API in its current state, you'll need to do the following:
@@ -0,0 +1,21 @@
1
+ module NikeV2
2
+ class ExperienceType
3
+ TO_S_MAP = {
4
+ 'fuelband' => 'Fuel Band',
5
+ 'npluskinecttrg' => 'Nike+ Kinect',
6
+ 'running' => 'Running'
7
+ }
8
+
9
+ def initialize(code)
10
+ @code = code
11
+ end
12
+
13
+ def code
14
+ @code
15
+ end
16
+
17
+ def to_s
18
+ TO_S_MAP[code.downcase]
19
+ end
20
+ end
21
+ end
@@ -8,7 +8,20 @@ module NikeV2
8
8
  def initialize(attributes = {})
9
9
  raise "#{self.class} requires a person." unless attributes.keys.include?(:person)
10
10
  set_attributes(attributes)
11
- super(fetch_data)
11
+ super(initialize_data)
12
+ end
13
+
14
+ private
15
+ def initialize_data
16
+ fuel_data = fetch_data
17
+ initialization_data = {
18
+ 'activity_types' => fuel_data['experienceTypes'].collect{|a| ExperienceType.new(a)}
19
+ }
20
+ fuel_data['summaries'].each do |data|
21
+ initialization_data[data['experienceType'].downcase] = data['records']
22
+ end
23
+
24
+ initialization_data
12
25
  end
13
26
  end
14
27
  end
data/lib/nike_v2.rb CHANGED
@@ -2,6 +2,7 @@ require 'httparty'
2
2
  require 'forwardable'
3
3
  require 'ext/core_ext'
4
4
  require 'nike_v2/base'
5
+ require 'nike_v2/experience_type'
5
6
  require 'nike_v2/resource'
6
7
  require 'nike_v2/person'
7
8
  require 'nike_v2/activities'
@@ -10,5 +11,5 @@ require 'nike_v2/summary'
10
11
  require 'nike_v2/gps_data'
11
12
 
12
13
  module NikeV2
13
- VERSION = '0.1.0'
14
+ VERSION = '0.1.1'
14
15
  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.0
4
+ version: 0.1.1
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-01-27 00:00:00.000000000 Z
12
+ date: 2013-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -123,6 +123,7 @@ files:
123
123
  - lib/nike_v2/activities.rb
124
124
  - lib/nike_v2/activity.rb
125
125
  - lib/nike_v2/base.rb
126
+ - lib/nike_v2/experience_type.rb
126
127
  - lib/nike_v2/gps_data.rb
127
128
  - lib/nike_v2/person.rb
128
129
  - lib/nike_v2/resource.rb