public function create($files, $public = false, $description = null)
	{
		// Build the request path.
		$path = '/gists';

		// Build the request data.
		$data = json_encode(
			array(
				'files'       => $this->buildFileData((array) $files),
				'public'      => (bool) $public,
				'description' => $description
			)
		);

		// Send the request.
		$response = $this->client->post($this->fetchUrl($path), $data);

		// Validate the response code.
		if ($response->code != 201)
		{
			// Decode the error response and throw an exception.
			$error = json_decode($response->body);
			throw new \DomainException($error->message, $response->code);
		}

		return json_decode($response->body);
	}
public function create($files, $public = false, $description = null)
	{
		// Build the request path.
		$path = '/gists';

		// Build the request data.
		$data = json_encode(
			array(
				'files'       => $this->buildFileData((array) $files),
				'public'      => (bool) $public,
				'description' => $description
			)
		);

		// Send the request.
		$response = $this->client->post($this->fetchUrl($path), $data);

		// Validate the response code.
		if ($response->code != 201)
		{
			// Decode the error response and throw an exception.
			$error = json_decode($response->body);
			throw new \DomainException($error->message, $response->code);
		}

		return json_decode($response->body);
	}
public function create ( $ files , $ public = false , $ description = null ) { // Build the request path. $ path = '/gists' ; // Build the request data. $ data = json_encode ( array ( 'files' => $ this -> buildFileData ( ( array ) $ files ) , 'public' => ( bool ) $ public , 'description' => $ description ) ) ; // Send the request. $ response = $ this -> client -> post ( $ this -> fetchUrl ( $ path ) , $ data ) ; // Validate the response code. if ( $ response -> code != 201 ) { // Decode the error response and throw an exception. $ error = json_decode ( $ response -> body ) ; throw new \ DomainException ( $ error -> message , $ response -> code ) ; } return json_decode ( $ response -> body ) ; }
Method to create a gist.

@param   mixed    $files        Either an array of file paths or a single file path as a string.
@param   boolean  $public       True if the gist should be public.
@param   string   $description  The optional description of the gist.

@return  object

@since   1.0
@throws  \DomainException
Method to create a gist .