health_graph 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
data/health_graph.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{health_graph}
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
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 = %q{2012-02-18}
12
+ s.date = %q{2012-03-03}
13
13
  s.description = %q{This is a wrapper for RunKeeper Health Graph RESTful API.}
14
14
  s.email = %q{kenny@kennyma.me}
15
15
  s.extra_rdoc_files = [
@@ -14,9 +14,9 @@ module HealthGraph
14
14
  end
15
15
  end
16
16
 
17
- def initialize(access_token, path)
17
+ def initialize(access_token, path, params = {})
18
18
  self.access_token = access_token
19
- response = get path, HealthGraph.accept_headers[:fitness_activity_feed]
19
+ response = get path, HealthGraph.accept_headers[:fitness_activity_feed], params
20
20
  self.body = response.body
21
21
  populate_from_hash! self.body
22
22
  end
@@ -23,11 +23,11 @@ module HealthGraph
23
23
  HealthGraph::SleepFeed.new self.access_token, self.body["sleep"]
24
24
  end
25
25
 
26
- def fitness_activities
27
- HealthGraph::FitnessActivitiesFeed.new self.access_token, self.body["fitness_activities"]
26
+ def fitness_activities params = {}
27
+ HealthGraph::FitnessActivitiesFeed.new self.access_token, self.body["fitness_activities"], params
28
28
  end
29
29
 
30
- def new_fitness_activity(params)
30
+ def new_fitness_activity params
31
31
  HealthGraph::NewFitnessActivity.new self.access_token, params
32
32
  end
33
33
  end
@@ -10,6 +10,10 @@ class TestFitnessActivitiesFeed < Test::Unit::TestCase
10
10
  stub_request(:get, HealthGraph.endpoint + '/fitnessActivities')
11
11
  .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]})
12
12
  .to_return(:body => fixture('fitness_activities_feed.json'))
13
+
14
+ stub_request(:get, HealthGraph.endpoint + '/fitnessActivities?pageSize=3')
15
+ .with(:header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]})
16
+ .to_return(:body => fixture('fitness_activities_feed.json'))
13
17
 
14
18
  @user = HealthGraph::User.new(TEST_USER_TOKEN)
15
19
  end
@@ -20,6 +24,11 @@ class TestFitnessActivitiesFeed < Test::Unit::TestCase
20
24
  assert_requested :get, HealthGraph.endpoint + '/fitnessActivities', :header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]}, :times => 1
21
25
  end
22
26
 
27
+ should "make request to api with params" do
28
+ @user.fitness_activities(:pageSize => 3)
29
+ assert_requested :get, HealthGraph.endpoint + '/fitnessActivities?pageSize=3', :header => {'Authorization' => 'Bearer ' + TEST_USER_TOKEN, 'Accept' => HealthGraph.accept_headers[:fitness_activities_feed]}, :times => 1
30
+ end
31
+
23
32
  should "get body" do
24
33
  expected = {"items"=>
25
34
  [{"duration"=>7920,
@@ -82,8 +91,7 @@ class TestFitnessActivitiesFeed < Test::Unit::TestCase
82
91
 
83
92
  assert_equal expected, @user.fitness_activities.items
84
93
  assert_equal 5, @user.fitness_activities.items.size
85
- end
86
-
94
+ end
87
95
 
88
96
  should "get start time" do
89
97
  assert_equal "Thu, 15 Sep 2011 13:28:59", @user.fitness_activities.items[0].start_time
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 2
9
- version: 0.5.2
8
+ - 3
9
+ version: 0.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kenny Ma
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-18 00:00:00 -08:00
17
+ date: 2012-03-03 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -284,7 +284,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
284
284
  requirements:
285
285
  - - ">="
286
286
  - !ruby/object:Gem::Version
287
- hash: 2017150975927793976
287
+ hash: -2777065624712929792
288
288
  segments:
289
289
  - 0
290
290
  version: "0"