You are here

public function Instagram::call in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.lib.php \Instagram::call()

Method for calling any drupagram api resource

1 call to Instagram::call()
Instagram::fetch in ./drupagram.lib.php
Get an array of Instagram objects from an API endpoint

File

./drupagram.lib.php, line 339
Classes to implement the full Instagram API

Class

Instagram
Primary Instagram API implementation class Supports the full REST API for drupagram.

Code

public function call($path, $params = array(), $method = 'GET', $use_auth = FALSE) {
  $url = $this
    ->create_url($path, '');
  try {
    if ($use_auth) {
      $response = $this
        ->auth_request($url, $params, $method);
    }
    else {
      $response = $this
        ->request($url, $params, $method);
    }
  } catch (InstagramException $e) {
    watchdog('drupagram', '!message', array(
      '!message' => $e
        ->__toString(),
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  if (!$response) {
    return FALSE;
  }
  return $this
    ->parse_response($response);
}