GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 71f83d...bc7c18 )
by Juan Jose
06:10
created

SetGPS   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 92.31%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 36
ccs 12
cts 13
cp 0.9231
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A GPS.set_gps_track() 0 14 2
A GPS.__init__() 0 4 1
1 1
from .api_endpoints import SET_GPS_HOST, DEVICE_LOCATION_URL
2 1
from .base import Base
3 1
from .exceptions import ParamValueException
4
5
6 1
class GPS(Base):
7
    """
8
        Set GPS position of the device
9
    """
10
11 1
    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 1
    def __init__(self, api):
24 1
        self.response = None
25 1
        self.params = {'api_key': api.key, }
26 1
        Base.__init__(self, api)
27
28 1
    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 1
        kwargs.update({'api_key': self.params['api_key'], })
35 1
        if self.check_required_params(kwargs, self.requirements):
36 1
            self.response = self.api._request_get(SET_GPS_HOST,
37
                                                  kwargs)
38 1
            response = self.response.json()
39 1
            return response.get('status')
40
        else:
41
            raise ParamValueException('params', 'Params are not complete')
42
43 1
    def get_locations(self, **kwargs):
44
        """
45
        Get GPS tracks of a vehicle using GET request
46
        :return: Response status
47
        :raise: ParamValueException if any required param is not set
48
        """
49
        kwargs.update({'api_key': self.params['api_key'], })
50
        if self.check_required_params(kwargs, [
51
            'api_key',
52
            'format',
53
            'route_id',
54
            'member_id',
55
            'time_period',
56
        ]):
57
            self.response = self.api._request_get(DEVICE_LOCATION_URL,
58
                                                  kwargs)
59
            return self.response.json()
60
        else:
61
            raise ParamValueException('params', 'Params are not complete')
62