Module: Topsy

Defined in:
lib/topsy/tag.rb,
lib/topsy.rb,
lib/topsy/page.rb,
lib/topsy/stats.rb,
lib/topsy/trend.rb,
lib/topsy/tweet.rb,
lib/topsy/author.rb,
lib/topsy/client.rb,
lib/topsy/target.rb,
lib/topsy/version.rb,
lib/topsy/linkpost.rb,
lib/topsy/url_info.rb,
lib/topsy/search_counts.rb,
lib/topsy/linkpost_count.rb,
lib/topsy/rate_limit_info.rb,
lib/topsy/link_search_result.rb

Overview

This is the link_search_result class for the topsy library. A LinkSearchResult has the following attributes:

"trackback_permalink" : "http://twitter.com/ewerickson/status/3562164195",
"hits" : 38,
"trackback_total" : 157,
"topsy_trackback_url" : "http://topsy.com/tb/www.redstate.com/erick/2009/08/26/breaking-rumors-surface-that-leon-panetta-is-resigning/",
"url" : "http://www.redstate.com/erick/2009/08/26/breaking-rumors-surface-that-leon-panetta-is-resigning/",
"content" : "Panetta is rumored to have sent a resignation letter to Barack Obama today:  http://bit.ly/CDMg9",
"title" : "BREAKING: Rumors Surface That Leon Panetta is Resigning - Erick’s blog - RedState",
"score" : 0.75521481,
"highlight" : "Panetta is rumored to have sent a resignation letter to 
    <span class=\"highlight-term\">Barack</span> <span class=\"highlight-term\">Obama</span> today:  http://bit.ly/CDMg9"

According to the official Topsy doc: code.google.com/p/otterapi/wiki/Resources?tm=6#/search

Defined Under Namespace

Classes: Author, Client, General, InformTopsy, LinkSearchResult, Linkpost, LinkpostCount, NotFound, Page, RateLimitExceeded, RateLimitInfo, SearchCounts, Stats, Tag, Target, TopsyError, Trend, Tweet, Unauthorized, Unavailable, UrlInfo

Constant Summary collapse

VERSION =
'0.3.5'

Class Method Summary collapse

Class Method Details

.author_info(url) ⇒ Topsy::Author

Returns profile information for an author (a twitter profile indexed by Topsy). The response contains the name, description (biography) and the influence level of the author



31
32
33
# File 'lib/topsy.rb', line 31

def self.author_info(url)
  Topsy::Client.new.author_info(url)
end

.author_search(q, options = {}) ⇒ Topsy::Page

Returns list of authors that talk about the query. The list is sorted by frequency of posts and the influence of authors.

Options Hash (options):

  • :window (Symbol)

    Time window for results. (default: :auto) Options: :auto - automatically pick the most recent and relevant window. :hour last hour, :day last day, :week last week, :month last month, :all all time

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



44
45
46
47
# File 'lib/topsy.rb', line 44

def self.author_search(q, options={})
  result = Topsy::Client.new.author_search(q, options)
  Topsy::Page.new(result, Topsy::Author)
end

.creditTopsy::RateLimitInfo

Returns info about API rate limiting



170
171
172
# File 'lib/topsy.rb', line 170

def self.credit
  Topsy::Client.new.credit
end

.link_post_count(url, options = {}) ⇒ Topsy::LinkpostCount

Returns count of links posted by an author. This is the efficient, count-only version of /linkposts

Options Hash (options):

  • :contains (String)

    Query string to filter results



67
68
69
70
# File 'lib/topsy.rb', line 67

def self.link_post_count(url, options={})
  response = Topsy::Client.new.link_post_count(url, options)
  Topsy::LinkpostCount.new(response)
end

Returns list of URLs posted by an author

Options Hash (options):

  • :contains (String)

    Query string to filter results

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



57
58
59
# File 'lib/topsy.rb', line 57

def self.link_posts(url, options={})
  Topsy::Client.new.link_posts(url, options)
end

.profile_search(q, options = {}) ⇒ Topsy::Page

Returns list list of author profiles that match the query. The query is matched against the nick, name and biography information and the results are sorted by closeness of match and the influence of authors.

Options Hash (options):

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



79
80
81
# File 'lib/topsy.rb', line 79

def self.profile_search(q, options={})
  Topsy::Client.new.profile_search(q, options)
end

.rate_limitObject



175
176
177
178
# File 'lib/topsy.rb', line 175

def self.rate_limit
  self.credit if @rate_limit_info.nil?
  @rate_limit_info
end

.rate_limit=(info) ⇒ Object



180
181
182
# File 'lib/topsy.rb', line 180

def self.rate_limit=(info)
  @rate_limit_info = Topsy::RateLimitInfo.new(info)
end

Returns list of URLs related to a given URL

Options Hash (options):

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



90
91
92
# File 'lib/topsy.rb', line 90

def self.related(url, options={})
  Topsy::Client.new.related(url, options)
end

.search(q, options = {}) ⇒ Topsy::Page

Returns list of results for a query.

Options Hash (options):

  • :window (Symbol)

    Time window for results. (default: :auto) Options: :auto - automatically pick the most recent and relevant window. :hour last hour, :day last day, :week last week, :month last month, :realtime, :all all time

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



102
103
104
# File 'lib/topsy.rb', line 102

def self.search(q, options={})
  Topsy::Client.new.search(q, options)
end

.search_count(q) ⇒ Topsy::SearchCounts

Returns count of results for a search query.



110
111
112
# File 'lib/topsy.rb', line 110

def self.search_count(q)
  Topsy::Client.new.search_count(q)
end

.stats(url, options = {}) ⇒ Topsy::Stats

Returns counts of tweets for a URL

Options Hash (options):

  • :contains (String)

    Query string to filter results



120
121
122
# File 'lib/topsy.rb', line 120

def self.stats(url, options={})
  Topsy::Client.new.stats(url, options)
end

.tags(url, options = {}) ⇒ Topsy::Page

Returns list of tags for a URL.

Options Hash (options):

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



131
132
133
# File 'lib/topsy.rb', line 131

def self.tags(url, options={})
  Topsy::Client.new.tags(url, options)
end

.trackbacks(url, options = {}) ⇒ Topsy::Page

Returns list of tweets (trackbacks) that mention the query URL, most recent first.

Options Hash (options):

  • :contains (String)

    Query string to filter results

  • :infonly (Boolean)

    filters trackbacks to influential only (default 0)

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



144
145
146
# File 'lib/topsy.rb', line 144

def self.trackbacks(url, options={})
  Topsy::Client.new.trackbacks(url, options)
end

Returns list of trending terms

Options Hash (options):

  • :page (Integer)

    page number of the result set. (default: 1, max: 10)

  • :perpage (Integer)

    limit number of results per page. (default: 10, max: 50)



155
156
157
# File 'lib/topsy.rb', line 155

def self.trending(options={})
  Topsy::Client.new.trending(options)
end

.url_info(url) ⇒ Topsy::UrlInfo

Returns info about a URL



163
164
165
# File 'lib/topsy.rb', line 163

def self.url_info(url)
  Topsy::Client.new.url_info(url)
end