runkeeper 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,12 @@
4
4
  ## Example
5
5
  user = Runkeeper.new("user token")
6
6
  puts user.name
7
- activity = user.new_activity(:duration => 60, :type => "Swimming", :distance => 1000
7
+ activity = user.new_activity(:duration => 60, :type => "Swimming", :distance => 1000)
8
8
  activity.save
9
9
  puts user.activity_url(activity)
10
+
11
+ ## Generating a token
12
+ $ gem install launchy rack
13
+ $ CLIENT_ID="your client id" CLIENT_SECRET="your secret" AUTHORIZATION_URL="https://runkeeper.com/apps/authorize" ACCESS_TOKEN_URL="https://runkeeper.com/apps/token" token_generator
14
+ Use your browser to allow access
15
+ Then check your console for the token
@@ -2,7 +2,7 @@ class Runkeeper
2
2
 
3
3
  class Activity
4
4
  attr_reader :connection, :url
5
- attr_reader :type, :start_time, :total_distance, :duration, :average_heart_rate, :total_calories, :notes, :path, :post_to_facebook, :post_to_twitter
5
+ attr_accessor :type, :start_time, :total_distance, :duration, :average_heart_rate, :total_calories, :notes, :path, :post_to_facebook, :post_to_twitter
6
6
 
7
7
  def initialize(connection, attrs)
8
8
  @connection = connection
@@ -13,11 +13,11 @@ class Runkeeper
13
13
  end
14
14
 
15
15
  def authorization_url
16
- @authorization_url || ENV['AUTHORIZATION_URL']
16
+ @authorization_url || ENV['AUTHORIZATION_URL'] || "https://runkeeper.com/apps/authorize"
17
17
  end
18
18
 
19
19
  def access_token_url
20
- @access_token_url || ENV['ACCESS_TOKEN_URL']
20
+ @access_token_url || ENV['ACCESS_TOKEN_URL'] || "https://runkeeper.com/apps/token"
21
21
  end
22
22
  end
23
23
 
@@ -20,6 +20,10 @@ class Runkeeper
20
20
  connection.user_response['userID']
21
21
  end
22
22
 
23
+ def user_name
24
+ profile =~ /\/user\/(.*)$/ && $1
25
+ end
26
+
23
27
  def fitness_activities
24
28
  connection.fitness_activities
25
29
  end
@@ -1,3 +1,3 @@
1
1
  class Runkeeper
2
- VERSION = "0.0.2".freeze
2
+ VERSION = "0.0.3".freeze
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: runkeeper
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Sandro Turriate
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-09 00:00:00 -06:00
13
+ date: 2011-07-25 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency