lib/strava/models/activity.rb in strava-ruby-client-0.3.0 vs lib/strava/models/activity.rb in strava-ruby-client-0.3.1
- old
+ new
@@ -1,9 +1,9 @@
module Strava
module Models
class Activity < Model
- include Mixins::MetricDistance
+ include Mixins::Distance
include Mixins::Time
include Mixins::Elevation
property 'id'
property 'resource_state'
@@ -58,12 +58,12 @@
property 'best_efforts', transform_with: ->(v) { v.map { |r| Strava::Models::SegmentEffort.new(r) } }
property 'photos', transform_with: ->(v) { Strava::Models::Photos.new(v) }
property 'similar_activities', transform_with: ->(v) { Strava::Models::SimilarActivities.new(v) }
property 'embed_token'
property 'available_zones'
- property 'splits_metric', transform_with: ->(v) { v.map { |r| Strava::Models::Split::Metric.new(r) } }
- property 'splits_standard', transform_with: ->(v) { v.map { |r| Strava::Models::Split::Standard.new(r) } }
+ property 'splits_metric', transform_with: ->(v) { v.map { |r| Strava::Models::Split.new(r) } }
+ property 'splits_standard', transform_with: ->(v) { v.map { |r| Strava::Models::Split.new(r) } }
property 'laps', transform_with: ->(v) { v.map { |r| Strava::Models::Lap.new(r) } }
property 'gear', transform_with: ->(v) { Strava::Models::Gear.new(v) }
property 'device_name'
property 'average_cadence'
property 'average_temp'
@@ -76,33 +76,21 @@
property 'segment_leaderboard_opt_out'
property 'leaderboard_opt_out'
def distance_s
if type == 'Swim'
- case units
- when :metric then distance_in_meters_s
- when :imperial then distance_in_yards_s
- end
+ distance_in_meters_s
else
- case units
- when :metric then distance_in_kilometers_s
- when :imperial then distance_in_miles_s
- end
+ distance_in_kilometers_s
end
end
def pace_s
case type
when 'Swim'
- case units
- when :metric then pace_per_100_meters_s
- when :imperial then pace_per_100_yards_s
- end
+ pace_per_100_meters_s
else
- case units
- when :metric then pace_per_kilometer_s
- when :imperial then pace_per_mile_s
- end
+ pace_per_kilometer_s
end
end
def strava_url
"https://www.strava.com/activities/#{id}"