@@ -23,6 +23,7 @@ public function __construct()
23
23
{
24
24
$ this ->vehApiToken = config ('laravel-vehapi.veh_api_token ' , null );
25
25
$ this ->vehApiVersion = config ('laravel-vehapi.veh_api_version ' , null );
26
+ $ this ->vehCheckSslCert = config ('laravel-vehapi.veh_check_ssl_cert ' , true );
26
27
}
27
28
28
29
/**
@@ -34,7 +35,11 @@ public function __construct()
34
35
*/
35
36
public function getAllYears ($ sort = 'asc ' )
36
37
{
37
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/years/ ' .$ sort ), true );
38
+ return json_decode (Http::withOptions ([
39
+ 'verify ' => $ this ->vehCheckSslCert
40
+ ])
41
+ ->withToken ($ this ->vehApiToken )
42
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/years/ ' .$ sort ), true );
38
43
}
39
44
40
45
/**
@@ -48,7 +53,11 @@ public function getAllYears($sort = 'asc')
48
53
*/
49
54
public function getYearsRange (int $ minYear , int $ maxYear , $ sort = 'asc ' )
50
55
{
51
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/range/years/ ' .$ minYear .'/ ' .$ maxYear .'/ ' .$ sort ), true );
56
+ return json_decode (Http::withOptions ([
57
+ 'verify ' => $ this ->vehCheckSslCert
58
+ ])
59
+ ->withToken ($ this ->vehApiToken )
60
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/range/years/ ' .$ minYear .'/ ' .$ maxYear .'/ ' .$ sort ), true );
52
61
}
53
62
54
63
/**
@@ -60,7 +69,11 @@ public function getYearsRange(int $minYear, int $maxYear, $sort = 'asc')
60
69
*/
61
70
public function getAllMakes ($ sort = 'asc ' )
62
71
{
63
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/all/car/makes/ ' .$ sort ), true );
72
+ return json_decode (Http::withOptions ([
73
+ 'verify ' => $ this ->vehCheckSslCert
74
+ ])
75
+ ->withToken ($ this ->vehApiToken )
76
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/all/car/makes/ ' .$ sort ), true );
64
77
}
65
78
66
79
/**
@@ -73,7 +86,11 @@ public function getAllMakes($sort = 'asc')
73
86
*/
74
87
public function getMakesByYear (int $ year , $ sort = 'asc ' )
75
88
{
76
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/makes/ ' .$ year .'/ ' .$ sort ), true );
89
+ return json_decode (Http::withOptions ([
90
+ 'verify ' => $ this ->vehCheckSslCert
91
+ ])
92
+ ->withToken ($ this ->vehApiToken )
93
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/makes/ ' .$ year .'/ ' .$ sort ), true );
77
94
}
78
95
79
96
/**
@@ -87,7 +104,11 @@ public function getMakesByYear(int $year, $sort = 'asc')
87
104
*/
88
105
public function getMakesByYearsRange (int $ minYear , int $ maxYear , $ sort = 'asc ' )
89
106
{
90
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/makes/in-range/ ' .$ minYear .'/ ' .$ maxYear .'/ ' .$ sort ), true );
107
+ return json_decode (Http::withOptions ([
108
+ 'verify ' => $ this ->vehCheckSslCert
109
+ ])
110
+ ->withToken ($ this ->vehApiToken )
111
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/makes/in-range/ ' .$ minYear .'/ ' .$ maxYear .'/ ' .$ sort ), true );
91
112
}
92
113
93
114
/**
@@ -100,7 +121,11 @@ public function getMakesByYearsRange(int $minYear, int $maxYear, $sort = 'asc')
100
121
*/
101
122
public function getAllModelsByMake (string $ make , $ sort = 'asc ' )
102
123
{
103
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/all/car/models/ ' .$ make .'/ ' .$ sort ), true );
124
+ return json_decode (Http::withOptions ([
125
+ 'verify ' => $ this ->vehCheckSslCert
126
+ ])
127
+ ->withToken ($ this ->vehApiToken )
128
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/all/car/models/ ' .$ make .'/ ' .$ sort ), true );
104
129
}
105
130
106
131
/**
@@ -114,7 +139,11 @@ public function getAllModelsByMake(string $make, $sort = 'asc')
114
139
*/
115
140
public function getModelsByYearAndMake (int $ year , string $ make , $ sort = 'asc ' )
116
141
{
117
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/models/ ' .$ year .'/ ' .$ make .'/ ' .$ sort ), true );
142
+ return json_decode (Http::withOptions ([
143
+ 'verify ' => $ this ->vehCheckSslCert
144
+ ])
145
+ ->withToken ($ this ->vehApiToken )
146
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/models/ ' .$ year .'/ ' .$ make .'/ ' .$ sort ), true );
118
147
}
119
148
120
149
/**
@@ -128,7 +157,11 @@ public function getModelsByYearAndMake(int $year, string $make, $sort = 'asc')
128
157
*/
129
158
public function getTrimsByYearMakeAndModel (int $ year , string $ make , string $ model )
130
159
{
131
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/trims/ ' .$ year .'/ ' .$ make .'/ ' .$ model ), true );
160
+ return json_decode (Http::withOptions ([
161
+ 'verify ' => $ this ->vehCheckSslCert
162
+ ])
163
+ ->withToken ($ this ->vehApiToken )
164
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/trims/ ' .$ year .'/ ' .$ make .'/ ' .$ model ), true );
132
165
}
133
166
134
167
/**
@@ -143,7 +176,11 @@ public function getTrimsByYearMakeAndModel(int $year, string $make, string $mode
143
176
*/
144
177
public function getTransmissionsByYearMakeModelAndTrim (int $ year , string $ make , string $ model , string $ trim )
145
178
{
146
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/transmissions/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim ), true );
179
+ return json_decode (Http::withOptions ([
180
+ 'verify ' => $ this ->vehCheckSslCert
181
+ ])
182
+ ->withToken ($ this ->vehApiToken )
183
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/transmissions/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim ), true );
147
184
}
148
185
149
186
/**
@@ -159,7 +196,53 @@ public function getTransmissionsByYearMakeModelAndTrim(int $year, string $make,
159
196
*/
160
197
public function getEnginesByYearMakeModelTrimAndTransmission (int $ year , string $ make , string $ model , string $ trim , string $ transmission )
161
198
{
162
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/engines/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim .'/ ' .$ transmission ), true );
199
+ return json_decode (Http::withOptions ([
200
+ 'verify ' => $ this ->vehCheckSslCert
201
+ ])
202
+ ->withToken ($ this ->vehApiToken )
203
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/engines/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim .'/ ' .$ transmission ), true );
204
+ }
205
+
206
+ /**
207
+ * Return options available for the year, make, model, transmission & engine supplied.
208
+ *
209
+ * @param int $year
210
+ * @param string $make
211
+ * @param string $model
212
+ * @param string $trim
213
+ * @param string $transmission
214
+ * @param string $engine
215
+ *
216
+ * @return mixed
217
+ */
218
+ public function getOptionsByYearMakeModelTrimTransmissionAndEngine (int $ year , string $ make , string $ model , string $ trim , string $ transmission , string $ engine )
219
+ {
220
+ return json_decode (Http::withOptions ([
221
+ 'verify ' => $ this ->vehCheckSslCert
222
+ ])
223
+ ->withToken ($ this ->vehApiToken )
224
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/options/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim .'/ ' .$ transmission .'/ ' .$ engine ), true );
225
+ }
226
+
227
+ /**
228
+ * Return wheels available for the year, make, model, transmission & engine supplied.
229
+ *
230
+ * @param int $year
231
+ * @param string $make
232
+ * @param string $model
233
+ * @param string $trim
234
+ * @param string $transmission
235
+ * @param string $engine
236
+ *
237
+ * @return mixed
238
+ */
239
+ public function getWheelsByYearMakeModelTrimTransmissionAndEngine (int $ year , string $ make , string $ model , string $ trim , string $ transmission , string $ engine )
240
+ {
241
+ return json_decode (Http::withOptions ([
242
+ 'verify ' => $ this ->vehCheckSslCert
243
+ ])
244
+ ->withToken ($ this ->vehApiToken )
245
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-lists/get/car/wheels/ ' .$ year .'/ ' .$ make .'/ ' .$ model .'/ ' .$ trim .'/ ' .$ transmission .'/ ' .$ engine ), true );
163
246
}
164
247
165
248
/**
@@ -171,6 +254,10 @@ public function getEnginesByYearMakeModelTrimAndTransmission(int $year, string $
171
254
*/
172
255
public function getMakeLogo (string $ make )
173
256
{
174
- return json_decode (Http::withToken ($ this ->vehApiToken )->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-logos/img/ ' .$ make ), true );
257
+ return json_decode (Http::withOptions ([
258
+ 'verify ' => $ this ->vehCheckSslCert
259
+ ])
260
+ ->withToken ($ this ->vehApiToken )
261
+ ->get ('https://vehapi.com/api/ ' .$ this ->vehApiVersion .'/car-logos/img/ ' .$ make ), true );
175
262
}
176
263
}
0 commit comments