Example #1
0
 /**
  * Fetches this object from Pantheon
  *
  * @param array $options Params to pass to url request
  * @return TerminusModel $this
  */
 public function fetch(array $options = array())
 {
     $fetch_args = array();
     if (isset($options['fetch_args'])) {
         $fetch_args = $options['fetch_args'];
     }
     $options = array_merge(array('options' => array('method' => 'get')), $this->getFetchArgs(), $fetch_args);
     $results = $this->request->simpleRequest($this->getFetchUrl(), $options);
     $this->attributes = $results['data'];
     return $this;
 }
Example #2
0
/**
 * Retrieves current version number from repository and saves it to the cache
 *
 * @return string The version number
 */
function checkCurrentVersion()
{
    $request = new Request();
    $url = 'https://api.github.com/repos/pantheon-systems/cli/releases';
    $url .= '?per_page=1';
    $response = $request->simpleRequest($url, array('absolute_url' => true));
    $release = array_shift($response['data']);
    Terminus::getCache()->putData('latest_release', array('version' => $release->name, 'check_date' => time()));
    return $release->name;
}