Completed
Pull Request — master (#436)
by Anthony
02:00
created

VehicleAction.run()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 2
1
from lib.actions import BaseAction
2
3
__all__ = [
4
    'VehicleAction'
5
]
6
7
8
class VehicleAction(BaseAction):
9
    def run(self, vin, action, **kwargs):
10
        if vin is None:
11
            vehicle = self.connection.vehicles()[0]
12
        else:
13
            vehicle = self.connection.vehicle(vin)
14
        response = action = getattr(vehicle, action)(**kwargs)
15
        return self.formatter.formatter(response)
16