With a mind boggling proportion of digital data available online, it is easy to get lost reminiscing about olden days when news reached to us at snail’s pace and when there was news broadcast only once or twice a day. However, with 24-hour radio, television and digital medium scrambling for your attention, it would be akin to a business suicide not to keep up with the speeding world.
Over the last few decades, technology, especially those of communication have taken a quantum leap forward. In this ultra-fast world, either a business can keep up or be ready to fold. No matter what kind of business you are in, providing relevant information to your customer should be a norm. The best method to provide trending information regarding your business is through adding trending topic to your website. Understanding and leveraging trending topics by accommodating them on your website is sure to give a competitive edge to your business. Even though trending topics incline heavily towards celebrity culture, the occasional mention of your industry or business may be enough to give your business a good deal of exposure. Besides giving your business a good coverage, trending topics might also be good if you can use the trending hashtags to tie it to your business content or when creating a blog. Creating blogs related to trending topics will give you lot of exposure. For instance, if you are into construction business and you find a particular design of a house in trending topic, you could pen down a blog related to designing a home and hop on the bandwagon of trending topics into the trending glory. Read on to learn how to implement trending topics into your Rails application.
Trending Topics Using Twitter Gem: For Document Ref: http://www.rubydoc.info/gems/twitter
Twitter::REST::API::Trendsincludes Twitter::REST::API::Utils
lib/twitter/rest/api/trends.rb
require ‘twitter/rest/api/utils’
require ‘twitter/place’
require ‘twitter/trend_results’
module Twitter
module REST
module API
module Trends
include Twitter::REST::API::Utils
# Returns the top 10 trending topics for a specific WOEID
#
# @see https://dev.twitter.com/docs/api/1.1/get/trends/place
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @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::REST::API::Trends#trend_locations}. Global information is available by using 1 as the WOEID.
# @param options [Hash] A customizable set of options.
# @option options [String] :exclude Setting this equal to ‘hashtags’ will remove all hashtags from the trends list.
# @return [Array<Twitter::Trend>]
def trends(id=1, options={})
options[:id] = id
object_from_response(Twitter::TrendResults, :get, “/1.1/trends/place.json”, options)
end
alias local_trends trends
alias trends_place trends
# Returns the locations that Twitter has trending topic information for
#
# @see https://dev.twitter.com/docs/api/1.1/get/trends/available
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @return [Array<Twitter::Place>]
def trends_available(options={})
objects_from_response(Twitter::Place, :get, “/1.1/trends/available.json”, options)
end
alias trend_locations trends_available
# Returns the locations that Twitter has trending topic information for, closest to a specified location.
#
# @see https://dev.twitter.com/docs/api/1.1/get/trends/closest
# @rate_limited Yes
# @authentication Requires user context
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @param options [Hash] A customizable set of options.
# @option options [Float] :lat If provided with a :long option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for latitude are -90.0 to +90.0 (North is positive) inclusive.
# @option options [Float] :long If provided with a :lat option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive.
# @return [Array<Twitter::Place>]
def trends_closest(options={})
objects_from_response(Twitter::Place, :get, “/1.1/trends/closest.json”, options)
end
end
end
end
end
Want to know more on how this and other gems function? With ingenious solutions, progressive business values, and proven track record, RailsCarma is best suited to help you with all your development needs. Our development process is established heavily on unrelenting attention to details, including quality, design and excellence. We convert your ideas into reality. Connect to us through our Contact Us page.
Read similar articles :