File tree Expand file tree Collapse file tree 14 files changed +194
-14
lines changed
api/client/endpoints/activities Expand file tree Collapse file tree 14 files changed +194
-14
lines changed Original file line number Diff line number Diff line change 11# This configuration was generated by
22# `rubocop --auto-gen-config`
3- # on 2025-10-16 14:15:33 UTC using RuboCop version 1.68.0.
3+ # on 2025-10-20 02:25:48 UTC using RuboCop version 1.68.0.
44# The point is for the user to remove these configuration records
55# one by one as the offenses are removed from the code base.
66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
9+ # Offense count: 1
10+ Lint/FloatComparison :
11+ Exclude :
12+ - ' spec/strava/models/lat_lng_spec.rb'
13+
914# Offense count: 1
1015RSpec/AnyInstance :
1116 Exclude :
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ There are several API changes.
5252
5353See [ #96 ] ( https://github.com/dblock/strava-ruby-client/pull/96 ) for details.
5454
55+ #### Latitude and Longitude are now instances of ` Strava::Models::LatLng `
56+
57+ Properties, such as ` DetailedActivity#start_latlng ` are now of the ` Strava::Models::LatLng ` type.
58+
59+ ``` ruby
60+ activity.start_latlng # Strava::Models::LatLng
61+ activity.start_latlng.to_a # [36.377702, -94.207242]
62+ activity.start_latlng.lat # 36.377702
63+ activity.start_latlng.lng # -94.207242
64+ ```
65+
66+ See [ #98 ] ( https://github.com/dblock/strava-ruby-client/pull/98 ) for details.
67+
5568#### Removed ` id ` from ` Strava::Models::Photo `
5669
5770The Strava Photos API returns ` unique_id ` and does not return ` id ` . The latter has been removed.
Original file line number Diff line number Diff line change 3838require_relative 'strava/models/token'
3939require_relative 'strava/models/authorization'
4040
41+ require_relative 'strava/models/lat_lng'
4142require_relative 'strava/models/achievement'
4243require_relative 'strava/models/activity_stats'
4344require_relative 'strava/models/activity_total'
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class ClubEvent < Strava::Models::Response
2323 property 'zone'
2424 property 'address'
2525 property 'joined'
26- property 'start_latlng'
26+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
2727
2828 def strava_url
2929 "https://www.strava.com/clubs/#{ club_id } /group_events/#{ id } "
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ class DetailedActivity < Strava::Models::Response
2020 property 'start_date' , transform_with : -> ( v ) { Time . parse ( v ) }
2121 include Mixins ::StartDateLocal
2222 property 'timezone'
23- property 'start_latlng'
24- property 'end_latlng'
23+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
24+ property 'end_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
2525 property 'achievement_count'
2626 property 'kudos_count'
2727 property 'comment_count'
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class DetailedSegment < Strava::Models::Response
1212 property 'maximum_grade'
1313 property 'elevation_high'
1414 property 'elevation_low'
15- property 'start_latlng'
16- property 'end_latlng'
15+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
16+ property 'end_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
1717 property 'climb_category'
1818 property 'city'
1919 property 'state'
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ class ExplorerSegment < Strava::Models::Response
99 property 'climb_category'
1010 property 'climb_category_desc'
1111 property 'avg_grade'
12- property 'start_latlng'
13- property 'end_latlng'
12+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
13+ property 'end_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
1414 property 'elev_difference'
1515 include Mixins ::Distance
1616 property 'points'
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ module Strava
4+ module Models
5+ class LatLng
6+ attr_accessor :latlng
7+
8+ def lat
9+ @latlng [ 0 ]
10+ end
11+
12+ def lng
13+ @latlng [ 1 ]
14+ end
15+
16+ def lat = ( value )
17+ @latlng ||= [ nil , nil ]
18+ @latlng [ 0 ] = value
19+ end
20+
21+ def lng = ( value )
22+ @latlng ||= [ nil , nil ]
23+ @latlng [ 1 ] = value
24+ end
25+
26+ def ==( other )
27+ case other
28+ when LatLng
29+ @latlng == other . to_a
30+ when Array
31+ @latlng == other
32+ else
33+ false
34+ end
35+ end
36+
37+ def to_a
38+ @latlng
39+ end
40+
41+ def initialize ( latlng = nil )
42+ @latlng = latlng
43+ end
44+ end
45+ end
46+ end
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ class SummaryActivity < Strava::Models::Response
1919 property 'start_date' , transform_with : -> ( v ) { Time . parse ( v ) }
2020 include Mixins ::StartDateLocal
2121 property 'timezone'
22- property 'start_latlng'
23- property 'end_latlng'
22+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
23+ property 'end_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
2424 property 'achievement_count'
2525 property 'kudos_count'
2626 property 'comment_count'
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class SummarySegment < Strava::Models::Response
1212 property 'maximum_grade'
1313 property 'elevation_high'
1414 property 'elevation_low'
15- property 'start_latlng'
16- property 'end_latlng'
15+ property 'start_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
16+ property 'end_latlng' , transform_with : -> ( v ) { Strava :: Models :: LatLng . new ( v ) }
1717 property 'climb_category'
1818 property 'city'
1919 property 'state'
You can’t perform that action at this time.
0 commit comments