-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathsummary_activity.rb
More file actions
214 lines (159 loc) · 7.17 KB
/
summary_activity.rb
File metadata and controls
214 lines (159 loc) · 7.17 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# frozen_string_literal: true
module Strava
module Models
#
# Represents a summary view of a Strava activity.
#
# A summary activity contains the most important information about an activity
# without the detailed segments, splits, and other extended data found in
# {DetailedActivity}. This model is typically returned when listing activities
# or when full details are not needed.
#
# Includes helper mixins for formatting distance, time, elevation, speed, and sport type.
#
# @example List and display activities
# activities = client.athlete_activities(per_page: 10)
# activities.each do |activity|
# puts "#{activity.name} - #{activity.distance_s} in #{activity.moving_time_in_hours_s}"
# puts activity.strava_url
# end
#
# @see DetailedActivity
# @see https://developers.strava.com/docs/reference/#api-models-SummaryActivity
#
class SummaryActivity < Strava::Models::Response
# @return [Integer] Activity ID
property 'id'
# @return [String, nil] External ID from the original upload source
property 'external_id'
# @return [Integer, nil] Upload ID
property 'upload_id'
# @return [MetaAthlete] The athlete who performed the activity
property 'athlete', transform_with: ->(v) { Strava::Models::MetaAthlete.new(v) }
# @return [String] Activity name
property 'name'
include Mixins::Distance
include Mixins::MovingTime
include Mixins::ElapsedTime
include Mixins::TotalElevationGain
# @return [Float, nil] Highest elevation in meters
property 'elev_high'
# @return [Float, nil] Lowest elevation in meters
property 'elev_low'
include Mixins::SportType
# @return [Time] Start date and time (UTC)
property 'start_date', transform_with: ->(v) { Time.parse(v) }
include Mixins::StartDateLocal
# @return [String] Timezone in which the activity was recorded
property 'timezone'
# @return [LatLng, nil] Starting coordinates [latitude, longitude]
property 'start_latlng', transform_with: ->(v) { Strava::Models::LatLng.new(v) }
# @return [LatLng, nil] Ending coordinates [latitude, longitude]
property 'end_latlng', transform_with: ->(v) { Strava::Models::LatLng.new(v) }
# @return [Integer] Number of achievements (segment PRs, CRs, etc.)
property 'achievement_count'
# @return [Integer] Number of kudos received
property 'kudos_count'
# @return [Integer] Number of comments
property 'comment_count'
# @return [Integer] Number of athletes who participated (group activities)
property 'athlete_count'
# @return [Integer] Number of photos attached
property 'photo_count'
# @return [Integer] Total number of photos including Instagram
property 'total_photo_count'
# @return [Map] Activity map with polyline data
property 'map', transform_with: ->(v) { Strava::Models::Map.new(v) }
# @return [Boolean] Whether this activity was on a stationary trainer
property 'trainer'
# @return [Boolean] Whether this activity was a commute
property 'commute'
# @return [Boolean] Whether this activity was manually entered
property 'manual'
# @return [Boolean] Whether this activity is set to private
property 'private'
# @return [Boolean] Whether this activity has been flagged
property 'flagged'
# @return [Integer, nil] Workout type (e.g., 10 = Race, 11 = Workout)
property 'workout_type'
# @return [String, nil] Upload ID as a string
property 'upload_id_str'
# @return [Float] Average speed in meters per second
property 'average_speed'
# @return [Float] Maximum speed in meters per second
property 'max_speed'
# @return [Boolean] Whether the authenticated athlete has kudoed this activity
property 'has_kudoed'
# @return [Boolean] Whether to hide this activity from the home feed
property 'hide_from_home'
# @return [String, nil] Gear (bike/shoes) ID used for this activity
property 'gear_id'
# @return [Float, nil] Kilojoules of energy expended
property 'kilojoules'
# @return [Float, nil] Average power in watts
property 'average_watts'
# @return [Boolean, nil] Whether the watts are from a power meter (true) or estimated (false)
property 'device_watts'
# @return [Integer, nil] Maximum power in watts
property 'max_watts'
# @return [Integer, nil] Weighted average power in watts
property 'weighted_average_watts'
# @note Undocumented in official API
# @return [Integer, nil] Resource state indicator
property 'resource_state'
# @note Undocumented in official API
# @return [String, nil] Activity visibility setting (e.g., 'everyone', 'followers_only')
property 'visibility'
# @note Undocumented in official API
# @return [Float, nil] UTC offset in seconds
property 'utc_offset'
# @note Undocumented in official API
# @return [String, nil] City where the activity took place
property 'location_city'
# @note Undocumented in official API
# @return [String, nil] State/province where the activity took place
property 'location_state'
# @note Undocumented in official API
# @return [String, nil] Country where the activity took place
property 'location_country'
# @note Undocumented in official API
# @return [Float, nil] Average cadence (RPM for cycling, steps/minute for running)
property 'average_cadence'
# @note Undocumented in official API
# @return [Float, nil] Average temperature during the activity in Celsius
property 'average_temp'
# @note Undocumented in official API
# @return [Boolean, nil] Whether the activity has heart rate data
property 'has_heartrate'
# @note Undocumented in official API
# @return [Float, nil] Average heart rate in beats per minute
property 'average_heartrate'
# @note Undocumented in official API
# @return [Float, nil] Maximum heart rate in beats per minute
property 'max_heartrate'
# @note Undocumented in official API
# @return [Boolean, nil] Whether the athlete has opted out of heart rate display
property 'heartrate_opt_out'
# @note Undocumented in official API
# @return [Boolean, nil] Whether to display the hide heart rate option
property 'display_hide_heartrate_option'
# @note Undocumented in official API
# @return [Boolean, nil] Whether the activity was created from an accepted tag
property 'from_accepted_tag'
# @note Undocumented in official API
# @return [Integer, nil] Number of personal records achieved in this activity
property 'pr_count'
# @note Undocumented in official API
# @return [Integer, nil] Relative effort score (suffer score)
property 'suffer_score'
#
# Returns the Strava web URL for this activity.
#
# @return [String] Full URL to view the activity on Strava.com
#
def strava_url
"https://www.strava.com/activities/#{id}"
end
end
end
end