-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrunning_race.rb
35 lines (31 loc) · 851 Bytes
/
running_race.rb
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
# frozen_string_literal: true
module Strava
module Models
class RunningRace < Strava::Models::Response
include Mixins::Distance
property 'id'
property 'resource_state'
property 'name'
property 'running_race_type'
property 'distance'
property 'start_date_local', transform_with: ->(v) { Time.parse(v) }
property 'city'
property 'state'
property 'country'
property 'route_ids'
property 'measurement_preference'
property 'url'
property 'website_url'
property 'status'
def strava_url
"https://www.strava.com/running-races/#{url}" if url
end
def distance_s
case measurement_preference
when 'meters' then distance_in_kilometers_s
when 'feet' then distance_in_miles_s
end
end
end
end
end