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



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

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

#pace_sObject



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

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

#sport_type_emojiObject



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

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



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

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