Sha256: 3b50cd2b32d9dadd9cc9a60bc7270d57d8dc639ea07e57fbf4e38b228d11732d

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

module Strava
  module Models
    class RunningRace < Model
      include Mixins::MetricDistance

      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strava-ruby-client-0.3.0 lib/strava/models/running_race.rb