예제 #1
0
 public function requestFilesFromGist(Gist $gist)
 {
     $client = new Client("https://api.github.com");
     $response = $client->get("/gists/{$gist->getId()}")->send();
     if (!$response->isSuccessful()) {
         throw new \Exception($response->getStatusCode() . ' ' . $response->getReasonPhrase());
     }
     $gist = json_decode($response->getBody(), true);
     return $gist['files'];
 }
예제 #2
0
 function it_can_request_files_from_a_gist(Gist $gist)
 {
     $gist->getId()->willReturn('bb7628ad34c699392f9c');
     $this->requestFilesFromGist($gist)->shouldBeArray();
 }