Sha256: 47d152684b7d36b6f5a5e9aa70bd03b7120d78f2a2d185f5d6745d2689205e29

Contents?: true

Size: 851 Bytes

Versions: 6

Compression:

Stored size: 851 Bytes

Contents

# 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
strava-ruby-client-2.2.0 lib/strava/models/running_race.rb
strava-ruby-client-2.1.0 lib/strava/models/running_race.rb
strava-ruby-client-2.0.0 lib/strava/models/running_race.rb
strava-ruby-client-1.1.0 lib/strava/models/running_race.rb
strava-ruby-client-1.0.1 lib/strava/models/running_race.rb
strava-ruby-client-1.0.0 lib/strava/models/running_race.rb