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.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 4
ccs 4
cts 4
cp 1
crap 1
rs 10
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