YQL will call to Yahoo YQL services
Usage:
Smoke.yql(:ruby) do select :all from "search.web" where :query, "ruby" end
Constants
API_BASE | = | "http://query.yahooapis.com/v1/public/yql" |
Attributes
request | [R] |
Public instance methods
from
(source)
[show source]
# File lib/smoke/source/yql.rb, line 34 34: def from(source) 35: @from = source.join(',') and return if source.is_a? Array 36: @from = source.to_s 37: end
select
(what = :all)
Select indicates what YQL will be selecting Usage:
select :all => "SELECT *" select :title => "SELECT title" select :title, :description => "SELECT title, description"
[show source]
# File lib/smoke/source/yql.rb, line 23 23: def select(what = :all) 24: @select = what.join(",") and return if what.is_a? Array 25: @select = "*" and return if what == :all 26: @select = what.to_s 27: end
use
(url)
`use` can be used to set the url location of the data-table that you want YQL to search upon
Usage:
use "http://datatables.org/alltables.env"
[show source]
# File lib/smoke/source/yql.rb, line 55 55: def use(url) 56: params.merge!({:env => url}) 57: end
where
(column, value)
where is a straight up match, no fancy matchers are currently supported Usage:
where :xpath, "//div/div/a"
or
where :query, "python"
[show source]
# File lib/smoke/source/yql.rb, line 45 45: def where(column, value) 46: @where = @where || [] 47: @where << "#{column.to_s} = '#{value}'" 48: end
Protected instance methods
dispatch
()
[show source]
# File lib/smoke/source/yql.rb, line 64 64: def dispatch 65: @request = Smoke::Request.new(build_uri) 66: self.items = [(@path.nil?) ? @request.body : drill(@request.body, *@path)] 67: end
params
()
[show source]
# File lib/smoke/source/yql.rb, line 60 60: def params 61: @params || @params = {} 62: end