Class: Google::Ajax::Feed::API::OneZero

Inherits:
Object
  • Object
show all
Defined in:
lib/google_ajax_feed_api/api/one_zero.rb

Class Method Summary collapse

Class Method Details

.findObject

The endpoint URI for search requests



13
14
15
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 13

def find
  "http://ajax.googleapis.com/ajax/services/feed/find"
end

.find_query(query) ⇒ Object

Builds a query to search for feeds query is a search term



29
30
31
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 29

def find_query query
  "#{find}#{params query}"
end

.loadObject

The endpoint URI for loading feeds



18
19
20
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 18

def load 
  "http://ajax.googleapis.com/ajax/services/feed/load"
end

.load_params(options = {}) ⇒ Object

:nodoc



39
40
41
42
43
44
45
46
47
48
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 39

def load_params options={} #:nodoc
  options = ({
    :limit => Feed.config.limit,
    :history => Feed.config.history
  }).merge(options)
  
  params = "&num=#{options[:limit]}"
  params << '&scoring=h' if options[:history]
  params        
end

.load_query(url, options = {}) ⇒ Object

Builds a query options are overrides for Feed#config options



35
36
37
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 35

def load_query url, options={}
  "#{load}#{params url}#{load_params options}"
end

.lookupObject

The endpoint URI for lookup requests



8
9
10
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 8

def lookup
  "http://ajax.googleapis.com/ajax/services/feed/lookup"
end

.lookup_query(url) ⇒ Object

Builds a query to lookup a feed for a url



23
24
25
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 23

def lookup_query url
  "#{lookup}#{params url}"
end

.params(query) ⇒ Object

:nodoc:



50
51
52
# File 'lib/google_ajax_feed_api/api/one_zero.rb', line 50

def params query #:nodoc:
  "?v=1.0&q=#{URI.encode query}"
end