Class Truveo
In: lib/truveo.rb
Parent: Object

The Truveo class implements a Ruby version of the Truveo API (see the Truveo Developer Site for details). A Truveo object is initialized with an developer id, which is free and can be obtained from the Truveo Developer Site. A developer id will allow you to call the Truveo API up to 10,000 times per day.

Currently user functions, like ratings, are not implemented in the Ruby API.

Methods

Public Class methods

array of Truveo supported filters such as type:free

Example:

  Truveo.filter.each{|f| puts f } # print all the filters

array of Truveo supported modifiers such as tag:

Example:

  Truveo.modifier.each{|m| puts m } # print all the modifiers

Create a new Truveo object for querying the Truveo video search engine. The appid is required. For your free appid go to My API Account where you easily sign up for your own appid, allowing you up to 10,000 Truveo queries per day.

Example:

    t = Truveo.new('my_appid')  # create a new Truveo object with your app_id

array of Truveo supported sorters such as sort:vrank

Example:

  Truveo.sorter.each{|s| puts s } # print all the sorters

Public Instance methods

Return a hash of the categories and counts related to the query.

The results and start parameters are used for paging through the result set.

Return a hash of the channels and counts related to the query.

The results and start parameters are used for paging through the result set.

Return a hash of the tags and counts related to the query.

The results and start parameters are used for paging through the result set.

Example:

  t = Truveo.new('appid_goes_here')
  res = t.get_related_tags('funny')
  res.tag_set.each_pair{|k,v| puts "tag: #{k} count: #{v}" }

Return a hash of the users and counts related to the query.

The results and start parameters are used for paging through the result set.

performs the specified query and returns the results in the form of a TruveoResponse object.

query:this is the search query to run. See Building Search Queries for details.
results:number of results to return, the default is 10, the maximum is 50.
start:where to start the result set being returned, defaults to 0. Can be used to page through results.
showRelatedItems:indicates if the tag set, category set, and user set should be returned. Values should be 0 or 1, the default is 0.
tagResults:number of tags requested in the tag_set response.
channelResults:number of channels requested in the channel_set response.
categoryResults:number of categories requested in the category_set response.
userResults:number of users requested in the user_set response.
showAdult:flag indicating whether or not adult content should be included in the result set.

All of the result sizes above are maximums. A query may return fewer than the requested number of results if the requested number of results don‘t match.

If the query string is empty, then the top results are returned in vrank order.

If showRelatedItems is zero, the response will only includea a video_set. The tag_set, channel_set, category_set, and user_set parameters will be left out.

[Validate]