-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdetailed_athlete.rb
More file actions
153 lines (118 loc) · 5 KB
/
detailed_athlete.rb
File metadata and controls
153 lines (118 loc) · 5 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# frozen_string_literal: true
module Strava
module Models
#
# Represents detailed information about a Strava athlete.
#
# Contains comprehensive profile information including personal details,
# preferences, gear, clubs, and social connections. This model is typically
# returned when accessing the authenticated athlete's own profile.
#
# @example Get athlete profile
# athlete = client.athlete
# puts athlete.name
# puts "Location: #{athlete.city}, #{athlete.state}, #{athlete.country}"
# puts "Premium: #{athlete.premium}"
# puts "Weight: #{athlete.weight}kg"
# puts athlete.strava_url
#
# @see SummaryAthlete
# @see https://developers.strava.com/docs/reference/#api-models-DetailedAthlete
#
class DetailedAthlete < Strava::Models::Response
# @return [Integer] Athlete ID
property 'id'
# @return [Integer] Resource state indicator
property 'resource_state'
# @return [String] First name
property 'firstname'
# @return [String] Last name
property 'lastname'
# @return [String, nil] URL to medium-sized profile picture
property 'profile_medium'
# @return [String, nil] URL to full-sized profile picture
property 'profile'
# @return [String, nil] City
property 'city'
# @return [String, nil] State or province
property 'state'
# @return [String, nil] Country
property 'country'
# @return [String] Sex ('M' for male, 'F' for female)
property 'sex'
# @return [Boolean] Whether the athlete has a premium subscription
property 'premium'
# @return [Boolean] Whether the athlete has a Summit subscription
property 'summit'
# @return [Time] When the athlete account was created
property 'created_at', transform_with: ->(v) { Time.parse(v) }
# @return [Time] When the athlete account was last updated
property 'updated_at', transform_with: ->(v) { Time.parse(v) }
# @return [Integer] Number of followers
property 'follower_count'
# @return [Integer] Number of friends (mutual follows)
property 'friend_count'
# @return [String] Preferred measurement system ('feet' or 'meters')
property 'measurement_preference'
# @return [Integer, nil] Functional Threshold Power in watts
property 'ftp'
# @return [Float, nil] Weight in kilograms
property 'weight'
# @return [Array<SummaryClub>] Clubs the athlete belongs to
property 'clubs', transform_with: ->(v) { v.map { |r| Strava::Models::SummaryClub.new(r) } }
# @return [Array<SummaryGear>] Bikes registered to this athlete
property 'bikes', transform_with: ->(v) { v.map { |r| Strava::Models::SummaryGear.new(r) } }
# @return [Array<SummaryGear>] Shoes registered to this athlete
property 'shoes', transform_with: ->(v) { v.map { |r| Strava::Models::SummaryGear.new(r) } }
# @note Undocumented in official API
# @return [String, nil] Username/vanity URL
property 'username'
# @note Undocumented in official API
# @return [String, nil] Athlete bio/description
property 'bio'
# @note Undocumented in official API
# @return [Integer, nil] Badge type identifier
property 'badge_type_id'
# @note Undocumented in official API
# @return [String, nil] Relationship status with authenticated athlete ('pending', 'accepted', 'blocked', or nil)
property 'friend'
# @note Undocumented in official API
# @return [String, nil] Follower relationship status
property 'follower'
# @note Undocumented in official API
# @return [Boolean, nil] Whether this athlete is blocked by the authenticated athlete
property 'blocked'
# @note Undocumented in official API
# @return [Boolean, nil] Whether the authenticated athlete can follow this athlete
property 'can_follow'
# @note Undocumented in official API
# @return [Integer, nil] Number of mutual friends with the authenticated athlete
property 'mutual_friend_count'
# @note Undocumented in official API
# @return [Integer, nil] Athlete type identifier (0 = Cyclist, 1 = Runner)
property 'athlete_type'
# @note Undocumented in official API
# @return [String, nil] Preferred date format
property 'date_preference'
# @note Undocumented in official API
# @return [Integer, nil] Number of clubs where athlete can post
property 'postable_clubs_count'
#
# Returns the athlete's full name.
#
# @return [String, nil] Full name combining firstname and lastname, or nil if neither exists
#
def name
[firstname, lastname].compact.join(' ') if firstname || lastname
end
#
# Returns the Strava web URL for this athlete's profile.
#
# @return [String] Full URL to view the athlete on Strava.com
#
def strava_url
"https://www.strava.com/athletes/#{username || id}"
end
end
end
end