-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
athlete.rb
45 lines (42 loc) · 1.35 KB
/
athlete.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true
module Strava
module Models
class Athlete < Strava::Models::Response
property 'id'
property 'username'
property 'resource_state'
property 'firstname'
property 'lastname'
property 'city'
property 'state'
property 'country'
property 'sex'
property 'premium'
property 'created_at', transform_with: ->(v) { Time.parse(v) }
property 'updated_at', transform_with: ->(v) { Time.parse(v) }
property 'badge_type_id'
property 'profile'
property 'profile_medium'
property 'follower'
property 'friend'
property 'summit'
property 'follower_count'
property 'friend_count'
property 'mutual_friend_count'
property 'athlete_type'
property 'date_preference'
property 'measurement_preference'
property 'clubs', transform_with: ->(v) { v.map { |r| Strava::Models::Club.new(r) } }
property 'ftp'
property 'weight'
property 'bikes', transform_with: ->(v) { v.map { |r| Strava::Models::Gear.new(r) } }
property 'shoes', transform_with: ->(v) { v.map { |r| Strava::Models::Gear.new(r) } }
def name
[firstname, lastname].compact.join(' ') if firstname || lastname
end
def strava_url
"https://www.strava.com/athletes/#{username || id}"
end
end
end
end