Class: Strava::Models::Activity

Inherits:
Response show all
Includes:
Mixins::Distance, Mixins::Elevation, Mixins::StartDateLocal, Mixins::Time
Defined in:
lib/strava/models/activity.rb

Instance Method Summary collapse

Methods included from Mixins::Elevation

#total_elevation_gain_in_feet, #total_elevation_gain_in_feet_s, #total_elevation_gain_in_meters, #total_elevation_gain_in_meters_s, #total_elevation_gain_s

Methods included from Mixins::Distance

#distance_in_feet, #distance_in_kilometers, #distance_in_kilometers_s, #distance_in_meters, #distance_in_meters_s, #distance_in_miles, #distance_in_miles_s, #distance_in_yards, #distance_in_yards_s

Methods included from Mixins::Time

#average_speed_meters_per_second, #elapsed_time_in_hours_s, #kilometer_per_hour_s, #miles_per_hour_s, #moving_time_in_hours_s, #pace_per_100_meters_s, #pace_per_100_yards_s, #pace_per_kilometer_s, #pace_per_mile_s, #speed_s

Instance Method Details

#distance_sObject



82
83
84
85
86
87
88
# File 'lib/strava/models/activity.rb', line 82

def distance_s
  if type == 'Swim'
    distance_in_meters_s
  else
    distance_in_kilometers_s
  end
end

#pace_sObject



90
91
92
93
94
95
96
97
# File 'lib/strava/models/activity.rb', line 90

def pace_s
  case type
  when 'Swim'
    pace_per_100_meters_s
  else
    pace_per_kilometer_s
  end
end

#sport_type_emojiObject



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
# File 'lib/strava/models/activity.rb', line 103

def sport_type_emoji
  case sport_type
  when 'AlpineSki' then '⛷️'
  when 'BackcountrySki' then '🎿️'
  # when "Canoeing" then ''
  # when "Crossfit" then ''
  # when "Elliptical" then ''
  when 'Golf' then '🏌️'
  # when "Handcycle" then ''
  when 'Hike' then '🥾'
  when 'IceSkate' then ''
  when 'InlineSkate' then "\u{1F6FC}"
  # when "Kayaking" then ''
  # when "Kitesurf" then ''
  when 'MountainBikeRide', 'EMountainBikeRide' then '🚵'
  # when "NordicSki" then ''
  when 'Ride', 'EBikeRide', 'VirtualRide', 'GravelRide' then '🚴'
  when 'RockClimbing' then '🧗'
  # when 'RollerSki' then ''
  when 'Rowing' then '🚣'
  when 'Run', 'VirtualRun', 'TrailRun' then '🏃'
  when 'Sail' then '⛵️'
  when 'Skateboard' then '🛹'
  when 'Snowboard' then '🏂'
  # when 'Snowshoe' then ''
  when 'Soccer' then '⚽️'
  # when 'StairStepper' then ''
  # when 'StandUpPaddling' then ''
  when 'Surfing' then '🏄'
  when 'Swim' then '🏊'
  # when 'Velomobile' then ''
  when 'Walk' then '🚶'
  when 'WeightTraining' then '🏋️'
  when 'Wheelchair' then ''
  # when 'Windsurf' then ''
  # when 'Workout' then ''
  when 'Yoga' then '🧘'
  end
end

#strava_urlObject



99
100
101
# File 'lib/strava/models/activity.rb', line 99

def strava_url
  "https://www.strava.com/activities/#{id}"
end

#type_emojiString

Deprecated.

Use #sport_type_emoji instead.

Returns precisely an emoji.

Returns:

  • (String)

    precisely an emoji



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
# File 'lib/strava/models/activity.rb', line 148

def type_emoji
  case type
  when 'Run', 'VirtualRun' then '🏃'
  when 'Ride', 'EBikeRide', 'VirtualRide' then '🚴'
  when 'Swim' then '🏊'
  when 'Walk' then '🚶'
  when 'AlpineSki' then '⛷️'
  when 'BackcountrySki' then '🎿️'
  # when 'Canoeing' then ''
  # when 'Crossfit' then ''
  # when 'Elliptical' then ''
  # when 'Hike' then ''
  when 'IceSkate' then '⛸️'
  # when 'InlineSkate' then ''
  # when 'Kayaking' then ''
  # when 'Kitesurf' then ''
  # when 'NordicSki' then ''
  when 'RockClimbing' then '🧗'
  when 'RollerSki' then ''
  when 'Rowing' then '🚣'
  when 'Snowboard' then '🏂'
  # when 'Snowshoe' then ''
  # when 'StairStepper' then ''
  # when 'StandUpPaddling' then ''
  when 'Surfing' then '🏄'
  when 'WeightTraining' then '🏋️'
  # when 'Windsurf' then ''
  when 'Wheelchair' then ''
    # when 'Workout' then ''
    # when 'Yoga'' then ''
  end
end