Example #1
0
 /**
  * @param       $endpoint
  * @param       $method
  * @param array $params
  *
  * @return mixed
  */
 public function call($endpoint, $method, array $params = [])
 {
     if (!in_array($endpoint, $this->endpoints)) {
         throw new InvalidArgumentException('No such endpoint');
     }
     $params['token'] = $this->auth->getToken();
     return $this->transport->call('https://' . $endpoint . $method, $params);
 }
Example #2
0
 public function it_make_api_calls(TransportInterface $transport, Auth $auth)
 {
     $auth->getToken()->willReturn('cb597b3e-cfc4-4329-abe0-5dc2b64a8e9a');
     $transport->call('https://api.oboom.com/method', ['param1' => 'aaa', 'param2' => 'bbb', 'token' => 'cb597b3e-cfc4-4329-abe0-5dc2b64a8e9a'])->shouldBeCalled();
     $this->call('api.oboom.com', '/method', ['param1' => 'aaa', 'param2' => 'bbb']);
 }