-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathlap.rb
More file actions
93 lines (73 loc) · 3.06 KB
/
lap.rb
File metadata and controls
93 lines (73 loc) · 3.06 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
# frozen_string_literal: true
module Strava
module Models
#
# Represents a lap within an activity.
#
# Laps are splits within an activity, either created manually by the athlete
# or auto-generated by the recording device. Each lap contains metrics like
# distance, time, speed, and elevation for that specific segment of the activity.
#
# Includes helper mixins for formatting distance, time, and elevation.
#
# @example List activity laps
# laps = client.activity_laps(1234567890)
# laps.each_with_index do |lap, i|
# puts "Lap #{i+1}: #{lap.name}"
# puts "Distance: #{lap.distance_s}"
# puts "Time: #{lap.moving_time_in_hours_s}"
# puts "Elevation: #{lap.total_elevation_gain_s}"
# end
#
# @see https://developers.strava.com/docs/reference/#api-models-Lap
#
class Lap < Strava::Models::Response
# @return [Integer] Lap ID
property 'id'
# @return [MetaActivity] The activity this lap belongs to
property 'activity', transform_with: ->(v) { Strava::Models::MetaActivity.new(v) }
# @return [MetaAthlete] The athlete who recorded this lap
property 'athlete', transform_with: ->(v) { Strava::Models::MetaAthlete.new(v) }
# @return [Float, nil] Average cadence (RPM for cycling, steps/minute for running)
property 'average_cadence'
# @return [Float] Average speed in meters per second
property 'average_speed'
include Mixins::Distance
include Mixins::MovingTime
include Mixins::ElapsedTime
# @return [Integer] Starting index in the activity's data stream
property 'start_index'
# @return [Integer] Ending index in the activity's data stream
property 'end_index'
# @return [Integer] The lap number (1-indexed)
property 'lap_index'
# @return [Float] Maximum speed in meters per second
property 'max_speed'
# @return [String] Lap name (e.g., 'Lap 1', 'Manual Lap')
property 'name'
# @return [Integer, nil] Pace zone indicator
property 'pace_zone'
# @return [Integer, nil] Split number within the lap
property 'split'
# @return [Time] Start date and time (UTC)
property 'start_date', transform_with: ->(v) { Time.parse(v) }
include Mixins::StartDateLocal
include Mixins::TotalElevationGain
# @note Undocumented in official API
# @return [Integer, nil] Resource state indicator
property 'resource_state'
# @note Undocumented in official API
# @return [Boolean, nil] Whether the watts are from a power meter (true) or estimated (false)
property 'device_watts'
# @note Undocumented in official API
# @return [Float, nil] Average power in watts
property 'average_watts'
# @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'
end
end
end