/** * Resolve the item from the IoC & execute the method on it * * @param array $arguments * @param array $columns * * @return \Spinen\ConnectWise\Library\Support\Collection */ public function execute(array $arguments = [], $columns = []) { $parameters = $this->get($this->getApiNamespace($this->method)); // Run through all of the keys in the argument, and call a setter on them if it exists foreach ($arguments as $argument => $value) { $setter = "set" . studly_case($argument); if (method_exists($parameters, $setter)) { $parameters->{$setter}($value); } } // Get the response from the WSDL $response = $this->get($this->getApiNamespace($this->api))->{$this->method}($parameters); // Unwrap all of the nested values that the WSDL returns $response = $this->converter->setApi($this->api)->setColumns($columns)->process($response); return $response; }
/** * @test */ public function it_sets_the_api() { $this->assertEquals($this->converter, $this->converter->setApi('someApi')); }