class JTwitterPlaces extends JTwitterObject

Twitter API Places & Geo class for the Joomla Platform.

Methods

__construct( Registry $options = null, JHttp $client = null, JTwitterOAuth $oauth = null)

Constructor.

void
checkRateLimit( string $resource = null, string $action = null)

Method to check the rate limit for the requesting IP address

string
fetchUrl( string $path, array $parameters = null)

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

array
getRateLimit( string $resource)

Method to retrieve the rate limit for the requesting IP address

array
sendRequest( string $path, string $method = 'GET', mixed $data = array(), array $headers = array())

Method to send the request.

mixed
getOption( string $key)

Get an option from the JTwitterObject instance.

setOption( string $key, mixed $value)

Set an option for the JTwitterObject instance.

array
getPlace( string $id)

Method to get all the information about a known place.

array
getGeocode( float $lat, float $long, string $accuracy = null, string $granularity = null, integer $max_results, string $callback = null)

Method to get up to 20 places that can be used as a place_id when updating a status.

array
search( float $lat = null, float $long = null, string $query = null, string $ip = null, string $granularity = null, string $accuracy = null, integer $max_results, string $within = null, string $attribute = null, string $callback = null)

Method to search for places that can be attached to a statuses/update.

array
getSimilarPlaces( float $lat, float $long, string $name, string $within = null, string $attribute = null, string $callback = null)

Method to locate places near the given coordinates which are similar in name.

array
createPlace( float $lat, float $long, string $name, string $geo_token, string $within, string $attribute = null, string $callback = null)

Method to create a new place object at the given latitude and longitude.

Details

__construct( Registry $options = null, JHttp $client = null, JTwitterOAuth $oauth = null)

Constructor.

Parameters

Registry $options &$options Twitter options object.
JHttp $client The HTTP client object.
JTwitterOAuth $oauth The OAuth client.

void checkRateLimit( string $resource = null, string $action = null)

Method to check the rate limit for the requesting IP address

Parameters

string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.
string $action An action for the specified resource, if only one resource is specified.

Return Value

void

Exceptions

RuntimeException

string fetchUrl( string $path, array $parameters = null)

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

Parameters

string $path URL to inflect
array $parameters The parameters passed in the URL.

Return Value

string The request URL.

array getRateLimit( string $resource)

Method to retrieve the rate limit for the requesting IP address

Parameters

string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for.

Return Value

array The JSON response decoded

array sendRequest( string $path, string $method = 'GET', mixed $data = array(), array $headers = array())

Method to send the request.

Parameters

string $path The path of the request to make
string $method The request method.
mixed $data Either an associative array or a string to be sent with the post request.
array $headers An array of name-value pairs to include in the header of the request

Return Value

array The decoded JSON response

Exceptions

RuntimeException

mixed getOption( string $key)

Get an option from the JTwitterObject instance.

Parameters

string $key The name of the option to get.

Return Value

mixed The option value.

JTwitterObject setOption( string $key, mixed $value)

Set an option for the JTwitterObject instance.

Parameters

string $key The name of the option to set.
mixed $value The option value to set.

Return Value

JTwitterObject This object for method chaining.

array getPlace( string $id)

Method to get all the information about a known place.

Parameters

string $id A place in the world. These IDs can be retrieved using getGeocode.

Return Value

array The decoded JSON response

array getGeocode( float $lat, float $long, string $accuracy = null, string $granularity = null, integer $max_results, string $callback = null)

Method to get up to 20 places that can be used as a place_id when updating a status.

Parameters

float $lat The latitude to search around.
float $long The longitude to search around.
string $accuracy A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet.
string $granularity This is the minimal granularity of place types to return and must be one of: poi, neighborhood, city, admin or country.
integer $max_results A hint as to the number of results to return.
string $callback If supplied, the response will use the JSONP format with a callback of the given name.

Return Value

array The decoded JSON response

Method to search for places that can be attached to a statuses/update.

Parameters

float $lat The latitude to search around.
float $long The longitude to search around.
string $query Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name.
string $ip An IP address.
string $granularity This is the minimal granularity of place types to return and must be one of: poi, neighborhood, city, admin or country.
string $accuracy A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet.
integer $max_results A hint as to the number of results to return.
string $within This is the place_id which you would like to restrict the search results to.
string $attribute This parameter searches for places which have this given street address.
string $callback If supplied, the response will use the JSONP format with a callback of the given name.

Return Value

array The decoded JSON response

Exceptions

RuntimeException

array getSimilarPlaces( float $lat, float $long, string $name, string $within = null, string $attribute = null, string $callback = null)

Method to locate places near the given coordinates which are similar in name.

Parameters

float $lat The latitude to search around.
float $long The longitude to search around.
string $name The name a place is known as.
string $within This is the place_id which you would like to restrict the search results to.
string $attribute This parameter searches for places which have this given street address.
string $callback If supplied, the response will use the JSONP format with a callback of the given name.

Return Value

array The decoded JSON response

array createPlace( float $lat, float $long, string $name, string $geo_token, string $within, string $attribute = null, string $callback = null)

Method to create a new place object at the given latitude and longitude.

Parameters

float $lat The latitude to search around.
float $long The longitude to search around.
string $name The name a place is known as.
string $geo_token The token found in the response from geo/similar_places.
string $within This is the place_id which you would like to restrict the search results to.
string $attribute This parameter searches for places which have this given street address.
string $callback If supplied, the response will use the JSONP format with a callback of the given name.

Return Value

array The decoded JSON response