Total Complexity | 3 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | from route4me.base import Base |
||
6 | class SetGPS(Base): |
||
7 | """ |
||
8 | Set GPS position of the device |
||
9 | """ |
||
10 | |||
11 | requirements = ('api_key', |
||
12 | 'format', |
||
13 | 'member_id', |
||
14 | 'route_id', |
||
15 | 'course', |
||
16 | 'speed', |
||
17 | 'lat', |
||
18 | 'lng', |
||
19 | 'device_type', |
||
20 | 'device_guid', |
||
21 | ) |
||
22 | |||
23 | def __init__(self, api): |
||
24 | self.response = None |
||
25 | self.params = {'api_key': api.key, } |
||
26 | Base.__init__(self, api) |
||
27 | |||
28 | def set_gps_track(self, **kwargs): |
||
29 | """ |
||
30 | Set GPS position of device using GET request |
||
31 | :return: Response status |
||
32 | :raise: ParamValueException if any required param is not set |
||
33 | """ |
||
34 | kwargs.update({'api_key': self.params['api_key'], }) |
||
35 | if self.check_required_params(kwargs, self.requirements): |
||
36 | self.response = self.api._request_get(SET_GPS_HOST, |
||
37 | self.params) |
||
38 | response = self.response.json() |
||
39 | return response.get('status') |
||
40 | else: |
||
41 | raise ParamValueException('params', 'Params are not complete') |
||
42 |