1
|
|
|
<?php |
2
|
|
|
namespace Strava\API\Service; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Strava stub Service |
6
|
|
|
* |
7
|
|
|
* @author Bas van Dorst |
8
|
|
|
* @package StravaPHP |
9
|
|
|
*/ |
10
|
|
|
class Stub implements ServiceInterface { |
11
|
1 |
|
public function getAthlete($id = null) { |
12
|
1 |
|
$json = '{ "id": 227615, "resource_state": 2, "firstname": "John", "lastname": "Applestrava", "profile_medium": "http://pics.com/227615/medium.jpg", "profile": "http://pics.com/227615/large.jpg", "city": "San Francisco", "state": "CA", "country": "United States", "sex": "M", "friend": null, "follower": "accepted", "premium": true, "created_at": "2011-03-19T21:59:57Z", "updated_at": "2013-09-05T16:46:54Z", "approve_followers": false }'; |
13
|
1 |
|
return $this->format($json); |
14
|
|
|
} |
15
|
|
|
|
16
|
1 |
|
public function getAthleteStats($id) { |
17
|
1 |
|
$json = '[ { "biggest_ride_distance": 175454.0, "biggest_climb_elevation_gain": 1882.6999999999998, "recent_ride_totals": { "count": 3, "distance": 12054.900146484375, "moving_time": 2190, "elapsed_time": 2331, "elevation_gain": 36.0, "achievement_count": 0 }, "recent_run_totals": { "count": 23, "distance": 195948.40002441406, "moving_time": 65513, "elapsed_time": 75232, "elevation_gain": 2934.3999996185303, "achievement_count": 46 }, "recent_swim_totals": { "count": 2, "distance": 1117.2000122070312, "moving_time": 1744, "elapsed_time": 1942, "elevation_gain": 0.0, "achievement_count": 0 }, "ytd_ride_totals": { "count": 134, "distance": 4927252, "moving_time": 659982, "elapsed_time": 892644, "elevation_gain": 49940 }, "ytd_run_totals": { "count": 111, "distance": 917100, "moving_time": 272501, "elapsed_time": 328059, "elevation_gain": 7558 }, "ytd_swim_totals": { "count": 8, "distance": 10372, "moving_time": 8784, "elapsed_time": 11123, "elevation_gain": 0 }, "all_ride_totals": { "count": 375, "distance": 15760015, "moving_time": 2155741, "elapsed_time": 2684286, "elevation_gain": 189238 }, "all_run_totals": { "count": 272, "distance": 2269557, "moving_time": 673678, "elapsed_time": 812095, "elevation_gain": 23780 }, "all_swim_totals": { "count": 8, "distance": 10372, "moving_time": 8784, "elapsed_time": 11123, "elevation_gain": 0} } ]'; |
18
|
1 |
|
return $this->format($json); |
19
|
|
|
} |
20
|
|
|
|
21
|
1 |
|
public function getAthleteClubs() { |
22
|
1 |
|
$json = '[ { "id": 1, "resource_state": 2, "name": "Team Strava Cycling", "profile_medium": "http://pics.com/clubs/1/medium.jpg", "profile": "http://pics.com/clubs/1/large.jpg" } ]'; |
23
|
1 |
|
return $this->format($json); |
24
|
|
|
} |
25
|
|
|
|
26
|
1 |
|
public function getAthleteActivities($before = null, $after = null, $page = null, $per_page = null) { |
27
|
1 |
|
$json = '{"response": 1}'; |
28
|
1 |
|
return $this->format($json); |
29
|
|
|
} |
30
|
|
|
|
31
|
1 |
|
public function getAthleteFriends($id = null, $page = null, $per_page = null) { |
32
|
1 |
|
$json = '{"response": 1}'; |
33
|
1 |
|
return $this->format($json); |
34
|
|
|
} |
35
|
|
|
|
36
|
1 |
|
public function getAthleteFollowers($id = null, $page = null, $per_page = null) { |
37
|
1 |
|
$json = '{"response": 1}'; |
38
|
1 |
|
return $this->format($json); |
39
|
|
|
} |
40
|
|
|
|
41
|
1 |
|
public function getAthleteBothFollowing($id, $page = null, $per_page = null) { |
42
|
1 |
|
$json = '{"response": 1}'; |
43
|
1 |
|
return $this->format($json); |
44
|
|
|
} |
45
|
|
|
|
46
|
1 |
|
public function getAthleteKom($id, $page = null, $per_page = null) { |
47
|
1 |
|
$json = '{"response": 1}'; |
48
|
1 |
|
return $this->format($json); |
49
|
|
|
} |
50
|
|
|
|
51
|
1 |
|
public function getAthleteStarredSegments($id = null, $page = null, $per_page = null) { |
52
|
1 |
|
$json = '{"response": 1}'; |
53
|
1 |
|
return $this->format($json); |
54
|
|
|
} |
55
|
|
|
|
56
|
1 |
|
public function updateAthlete($city, $state, $country, $sex, $weight) { |
57
|
1 |
|
$json = '{"response": 1}'; |
58
|
1 |
|
return $this->format($json); |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function getActivity($id, $include_all_efforts = null) { |
62
|
1 |
|
$json = '{"response": 1}'; |
63
|
1 |
|
return $this->format($json); |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
public function getActivityComments($id, $markdown = null, $page = null, $per_page = null) { |
67
|
1 |
|
$json = '{"response": 1}'; |
68
|
1 |
|
return $this->format($json); |
69
|
|
|
} |
70
|
|
|
|
71
|
1 |
|
public function getActivityKudos($id, $page = null, $per_page = null) { |
72
|
1 |
|
$json = '{"response": 1}'; |
73
|
1 |
|
return $this->format($json); |
74
|
|
|
} |
75
|
|
|
|
76
|
1 |
|
public function getActivityPhotos($id, $size = 2048, $photo_sources = 'true') { |
77
|
1 |
|
$json = '{"response": 1}'; |
78
|
1 |
|
return $this->format($json); |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
public function getActivityZones($id) { |
82
|
1 |
|
$json = '{"response": 1}'; |
83
|
1 |
|
return $this->format($json); |
84
|
|
|
} |
85
|
|
|
|
86
|
1 |
|
public function getActivityLaps($id) { |
87
|
1 |
|
$json = '{"response": 1}'; |
88
|
1 |
|
return $this->format($json); |
89
|
|
|
} |
90
|
|
|
|
91
|
1 |
|
public function getActivityUploadStatus($id) { |
92
|
1 |
|
$json = '{"response": 1}'; |
93
|
1 |
|
return $this->format($json); |
94
|
|
|
} |
95
|
|
|
|
96
|
1 |
|
public function createActivity($name, $type, $start_date_local, $elapsed_time, $description = null, $distance = null) { |
97
|
1 |
|
$json = '{"response": 1}'; |
98
|
1 |
|
return $this->format($json); |
99
|
|
|
} |
100
|
|
|
|
101
|
1 |
|
public function uploadActivity($file, $activity_type = null, $name = null, $description = null, $private = null, $trainer = null, $data_type = null, $external_id = null) { |
102
|
1 |
|
$json = '{"response": 1}'; |
103
|
1 |
|
return $this->format($json); |
104
|
|
|
} |
105
|
|
|
|
106
|
1 |
|
public function updateActivity($id, $name = null, $type = null, $private = false, $commute = false, $trainer = false, $gear_id = null, $description = null) { |
107
|
1 |
|
$json = '{"response": 1}'; |
108
|
1 |
|
return $this->format($json); |
109
|
|
|
} |
110
|
|
|
|
111
|
1 |
|
public function deleteActivity($id) { |
112
|
1 |
|
$json = '{"response": 1}'; |
113
|
1 |
|
return $this->format($json); |
114
|
|
|
} |
115
|
|
|
|
116
|
1 |
|
public function getGear($id) { |
117
|
1 |
|
$json = '{"response": 1}'; |
118
|
1 |
|
return $this->format($json); |
119
|
|
|
} |
120
|
|
|
|
121
|
1 |
|
public function getClub($id) { |
122
|
1 |
|
$json = '{"response": 1}'; |
123
|
1 |
|
return $this->format($json); |
124
|
|
|
} |
125
|
|
|
|
126
|
1 |
|
public function getClubMembers($id, $page = null, $per_page = null) { |
127
|
1 |
|
$json = '{"response": 1}'; |
128
|
1 |
|
return $this->format($json); |
129
|
|
|
} |
130
|
|
|
|
131
|
1 |
|
public function getClubActivities($id, $page = null, $per_page = null) { |
132
|
1 |
|
$json = '{"response": 1}'; |
133
|
1 |
|
return $this->format($json); |
134
|
|
|
} |
135
|
|
|
|
136
|
1 |
|
public function getClubAnnouncements($id) { |
137
|
1 |
|
$json = '{"response": 1}'; |
138
|
1 |
|
return $this->format($json); |
139
|
|
|
} |
140
|
|
|
|
141
|
1 |
|
public function getClubGroupEvents($id) { |
142
|
1 |
|
$json = '{"response": 1}'; |
143
|
1 |
|
return $this->format($json); |
144
|
|
|
} |
145
|
|
|
|
146
|
1 |
|
public function joinClub($id) { |
147
|
1 |
|
$json = '{"response": 1}'; |
148
|
1 |
|
return $this->format($json); |
149
|
|
|
} |
150
|
|
|
|
151
|
1 |
|
public function leaveClub($id) { |
152
|
1 |
|
$json = '{"response": 1}'; |
153
|
1 |
|
return $this->format($json); |
154
|
|
|
} |
155
|
|
|
|
156
|
1 |
|
public function getSegment($id) { |
157
|
1 |
|
$json = '{"response": 1}'; |
158
|
1 |
|
return $this->format($json); |
159
|
|
|
} |
160
|
|
|
|
161
|
1 |
|
public function getSegmentLeaderboard($id, $gender = null, $age_group = null, $weight_class = null, $following = null, $club_id = null, $date_range = null, $context_entries = null, $page = null, $per_page = null) { |
162
|
1 |
|
$json = '{"response": 1}'; |
163
|
1 |
|
return $this->format($json); |
164
|
|
|
} |
165
|
|
|
|
166
|
1 |
|
public function getSegmentExplorer($bounds, $activity_type = 'riding', $min_cat = null, $max_cat = null) { |
167
|
1 |
|
$json = '{"response": 1}'; |
168
|
1 |
|
return $this->format($json); |
169
|
|
|
} |
170
|
|
|
|
171
|
1 |
|
public function getSegmentEffort($id, $athlete_id = null, $start_date_local = null, $end_date_local = null, $page = null, $per_page = null) { |
172
|
1 |
|
$json = '{"response": 1}'; |
173
|
1 |
|
return $this->format($json); |
174
|
|
|
} |
175
|
|
|
|
176
|
1 |
|
public function getStreamsActivity($id, $types, $resolution = null, $series_type = 'distance') { |
177
|
1 |
|
$json = '{"response": 1}'; |
178
|
1 |
|
return $this->format($json); |
179
|
|
|
} |
180
|
|
|
|
181
|
1 |
|
public function getStreamsEffort($id, $types, $resolution = null, $series_type = 'distance') { |
182
|
1 |
|
$json = '{"response": 1}'; |
183
|
1 |
|
return $this->format($json); |
184
|
|
|
} |
185
|
|
|
|
186
|
1 |
|
public function getStreamsSegment($id, $types, $resolution = null, $series_type = 'distance') { |
187
|
1 |
|
$json = '{"response": 1}'; |
188
|
1 |
|
return $this->format($json); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param string $result |
193
|
|
|
*/ |
194
|
36 |
|
private function format($result) { |
195
|
36 |
|
return json_decode($result,true); |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|