public function testRequest() { $client = \Mockery::mock(Client::class, ['get' => new Response(200, [], '{"foo":"bar"}'), 'post' => new Response(200, [], '{"foo":"bar"}'), 'delete' => new Response(200, [], '{"foo":"bar"}'), 'put' => new Response(200, [], '{"foo":"bar"}')]); $api = new RESTfulService('foo', null, 'http://foo.com', $client); $this->assertObjectHasAttribute('foo', $api->get('/')); $this->assertObjectHasAttribute('foo', $api->post('/')); $this->assertObjectHasAttribute('foo', $api->put('/')); $this->assertObjectHasAttribute('foo', $api->delete('/')); }
/** * Construct an instance of Lastfm service. * * @param string $key Last.fm API key. * @param string $secret Last.fm API shared secret. * @param Client $client The Guzzle HTTP client. */ public function __construct($key = null, $secret = null, Client $client = null) { parent::__construct($key ?: env('LASTFM_API_KEY'), $secret ?: env('LASTFM_API_SECRET'), 'https://ws.audioscrobbler.com/2.0', $client ?: new Client()); }
/** * Construct an instance of YouTube service. * * @param string $key The YouTube API key * @param Client|null $client The Guzzle HTTP client */ public function __construct($key = null, Client $client = null) { parent::__construct($key ?: config('koel.youtube.key'), null, 'https://www.googleapis.com/youtube/v3', $client ?: new Client()); }
/** * Construct an instance of Lastfm service. * * @param string $key Last.fm API key. * @param string $secret Last.fm API shared secret. * @param Client $client The Guzzle HTTP client. */ public function __construct($key = null, $secret = null, Client $client = null) { parent::__construct($key ?: config('koel.lastfm.key'), $secret ?: config('koel.lastfm.secret'), 'https://ws.audioscrobbler.com/2.0', $client ?: new Client()); }