Class: Runkeeper::User

Inherits:
Object
  • Object
show all
Defined in:
lib/runkeeper/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ User

Returns a new instance of User.



6
7
8
9
# File 'lib/runkeeper/user.rb', line 6

def initialize(token)
  @token = token
  @connection = Connection.new(token)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/runkeeper/user.rb', line 4

def connection
  @connection
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/runkeeper/user.rb', line 4

def token
  @token
end

Instance Method Details

#activity_url(activity) ⇒ Object



39
40
41
# File 'lib/runkeeper/user.rb', line 39

def activity_url(activity)
  File.join(profile, "activity", activity.id)
end

#fitness_activitiesObject



27
28
29
# File 'lib/runkeeper/user.rb', line 27

def fitness_activities
  connection.fitness_activities
end

#idObject



19
20
21
# File 'lib/runkeeper/user.rb', line 19

def id
  connection.user_response['userID']
end

#new_activity(attrs = {}) ⇒ Object



35
36
37
# File 'lib/runkeeper/user.rb', line 35

def new_activity(attrs={})
  Activity.new(connection, attrs)
end

#past_activitiesObject



31
32
33
# File 'lib/runkeeper/user.rb', line 31

def past_activities
  connection.past_activities
end

#user_nameObject



23
24
25
# File 'lib/runkeeper/user.rb', line 23

def user_name
  profile =~ /\/user\/(.*)$/ && $1
end