sferik/twitter — pull request #388 by iirving (2013-04-21 23:14:00+00:00)
Title: added method Twitter::Trends::trends_with_meta_info

I've added a method to the api/trends.rb (trends_with_meta) which returns the other information back in addition to the array of "trends". The new method returns the "as_of", "created_at" "locations name" and "location woeid" values that the https://dev.twitter.com/docs/api/1.1/get/trends/place call returns rather than just trends array returned by the existing trends method.

as per the trends method, accepts a @param id [Integer] The {https://developer.yahoo.com/geo/geoplanet Yahoo! Where On Earth ID} of the location to return trending information for. WOEIDs can be retrieved by calling {Twitter::API::Trends#trend_locations}. Global information is available by using 1 as the WOEID.

returns a hash with the keys: "trends", "as_of", "created_at", "locations name" and "location woeid" (I considered making it a double hash to get the locations values, as per the json - ["locations"]["name"] and ["locations"]["woied"] - but decided to keep it simple)

I did this to fill my own need to to get the trends and the as_of values for woied's and figured someone else might find this useful.

many thanks for making and maintaining this gem!