Sha256: 190554a71dfe73b766a864dc857d207b0ab7e3c712ca0d29ba2e5226cd03198f

Contents?: true

Size: 801 Bytes

Versions: 5

Compression:

Stored size: 801 Bytes

Contents

module Strava
  module Models
    class RunningRace < Model
      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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
strava-ruby-client-0.4.2 lib/strava/models/running_race.rb
strava-ruby-client-0.4.1 lib/strava/models/running_race.rb
strava-ruby-client-0.4.0 lib/strava/models/running_race.rb
strava-ruby-client-0.3.2 lib/strava/models/running_race.rb
strava-ruby-client-0.3.1 lib/strava/models/running_race.rb