lib/strava/models/activity.rb in strava-ruby-client-0.4.3 vs lib/strava/models/activity.rb in strava-ruby-client-1.0.0

- old
+ new

@@ -1,21 +1,22 @@ # frozen_string_literal: true module Strava module Models - class Activity < Model + class Activity < Strava::Models::Response include Mixins::Time include Mixins::Distance include Mixins::Elevation include Mixins::StartDateLocal property 'id' property 'resource_state' property 'athlete', transform_with: ->(v) { Strava::Models::Athlete.new(v) } property 'name' property 'description' - property 'type' + property 'type' # deprecated + property 'sport_type' property 'workout_type' property 'id' property 'external_id' property 'upload_id' property 'start_date', transform_with: ->(v) { Time.parse(v) } @@ -97,9 +98,54 @@ def strava_url "https://www.strava.com/activities/#{id}" end + 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 + + # + # @deprecated Use {#sport_type_emoji} instead. + # + # @return [String] precisely an emoji + # def type_emoji case type when 'Run', 'VirtualRun' then '🏃' when 'Ride', 'EBikeRide', 'VirtualRide' then '🚴' when 'Swim' then '🏊'