Skip to content

Commit faa81ef

Browse files
committed
Fixed strava_url methods.
1 parent 1e325ab commit faa81ef

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

lib/strava/models/club_activity.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ class ClubActivity < Strava::Models::Response
1717
property 'workout_type'
1818
# undocumented
1919
property 'resource_state'
20-
21-
def strava_url
22-
"https://www.strava.com/activities/#{id}"
23-
end
2420
end
2521
end
2622
end

lib/strava/models/club_athlete.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ class ClubAthlete < Strava::Models::Response
1616
def name
1717
[firstname, lastname].compact.join(' ') if firstname || lastname
1818
end
19-
20-
def strava_url
21-
"https://www.strava.com/athletes/#{username || id}"
22-
end
2319
end
2420
end
2521
end

lib/strava/models/summary_athlete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def name
2424
end
2525

2626
def strava_url
27-
"https://www.strava.com/athletes/#{username || id}"
27+
"https://www.strava.com/athletes/#{id}"
2828
end
2929
end
3030
end

spec/strava/api/client/endpoints/activities/activity_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
expect(activity.athlete.resource_state).to eq 1
2828
expect(activity.name).to eq 'TCS NYC Marathon 2018'
2929
expect(activity.description).to eq "Official time 3:42:02. Race got impossibly hard at mile 21 but I never stopped except to pee on mile 9. \r\n\r\nI am so fucking happy that I did this!"
30+
expect(activity.strava_url).to eq 'https://www.strava.com/activities/1946417534'
3031

3132
expect(activity.distance).to eq 42_268.1
3233
expect(activity.distance_in_miles).to eq 26.264129297

spec/strava/api/client/endpoints/activities/athlete_activities_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
expect(athlete_activities).to be_a Enumerable
1111
expect(athlete_activities.count).to eq 30
1212
activity = athlete_activities.first
13+
expect(activity).to be_a(Strava::Models::SummaryActivity)
1314
expect(activity.id).to eq 16_181_809_559
15+
expect(activity.strava_url).to eq 'https://www.strava.com/activities/16181809559'
1416
expect(activity.athlete).to be_a Strava::Models::MetaAthlete
1517
expect(activity.map).to be_a Strava::Models::Map
1618
expect(activity.start_date).to be_a Time

spec/strava/api/client/endpoints/athletes/update_athlete_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
club = clubs.first
1515
expect(club).to be_a Strava::Models::SummaryClub
1616
expect(club.name).to eq 'New York Road Runners'
17+
expect(club.strava_url).to eq 'https://www.strava.com/clubs/nyrr'
1718
shoes = athlete.shoes
1819
expect(shoes).to be_a Enumerable
1920
shoe = shoes.first

spec/strava/api/client/endpoints/clubs/club_activities_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
expect(club_activities).to be_a Enumerable
1111
expect(club_activities.count).to eq 30
1212
activity = club_activities.first
13+
expect(activity).to be_a Strava::Models::ClubActivity
1314
expect(activity.distance).to eq 10_399.9
1415
expect(activity.name).to eq 'Run for The Nature Conservancy'
1516
end

spec/strava/api/client/endpoints/clubs/club_events_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
it 'returns a club event' do
2020
expect(event).to be_a Strava::Models::ClubEvent
21+
expect(event.title).to eq 'Gran Fondo Challenge Juni'
2122
expect(event.id).to be_a Integer
2223
expect(event.id).to eq(340_487)
2324
expect(event.created_at).to be_nil
@@ -38,6 +39,7 @@
3839
expect(event.upcoming_occurrences.first).to be_a Time
3940
expect(event.upcoming_occurrences.first).to eq(Time.new(2018, 6, 23, 8, 30, 0, '+00:00'))
4041
expect(event.joined).to be false
42+
expect(event.strava_url).to eq 'https://www.strava.com/clubs/456773/group_events/340487'
4143
end
4244
end
4345
end

spec/strava/api/client/endpoints/routes/athlete_routes_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
expect(route).to be_a Strava::Models::Route
1313
expect(route.id).to eq 3_329_485_690_369_457_990
1414
expect(route.athlete).to be_a Strava::Models::SummaryAthlete
15+
expect(route.athlete.strava_url).to eq 'https://www.strava.com/athletes/26462176'
1516
expect(route.name).to eq 'Little Island'
1617
expect(route.description).to be_nil
1718
expect(route.elevation_gain).to eq 19.770000000000003

0 commit comments

Comments
 (0)