Closed RobinJayaswal closed 7 years ago
@sankethkatta @gurpreetatwal will hold off on making changes before we decide if I should write out functions like in PythonSDK or if we should use another automation method.
@gurpreetatwal @sankethkatta this is ready for review again
@gurpreetatwal I didnt kill the json file since I need for mocking all the endpoints in the testing file:
Object.keys(methods).forEach(function(method) {
var config = methods[method];
if (config.type === 'action') {
apiNock
.post(`/vehicles/${VALID_VID}/${config.endpoint}`).times(2)
.matchHeader('Authorization', VALID_AUTHORIZATION)
.reply(200, SUCCESS);
} else {
apiNock
.get(`/vehicles/${VALID_VID}/${config.endpoint || ''}`)
.matchHeader('Authorization', VALID_AUTHORIZATION)
.reply(200, SUCCESS);
}
});
Methods are generated for the Vehicle prototype once, not once per vehicle. Refactor makes metric vs imperial a property on the vehicle ( #15 ), and makes it possible to pass multiple arguments to actions ( #16 ).