The “Data” source allows you to query datasources that are “complete” urls and rely on the automagic object parsing that smoke provides.
For example, you may use this source to query a complete restful api call unpackage the xml response and get a clean ruby object.
Data can take as many urls as you’d like to throw at it.
Usage:
Smoke.data(:ruby) do url "http://api.flickr.com/services/rest/?user_id=36821533%40N00&tags=benschwarz-site&nojsoncallback=1&method=flickr.photos.search&format=json&api_key=your_api_key_here path :photos, :photo end
Attributes
request | [R] |
Public instance methods
url
(source_url)
[show source]
# File lib/smoke/source/data.rb, line 24 24: def url(source_url) 25: @url = source_url 26: end
Protected instance methods
dispatch
()
[show source]
# File lib/smoke/source/data.rb, line 29 29: def dispatch 30: @request = Smoke::Request.new(@url) 31: self.items = (@path.nil?) ? @request.body : drill(@request.body, *@path) 32: end