Class: Smoke::Data
Overview
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
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Attributes inherited from Origin
#exposed, #items, #name, #requirements
Instance Method Summary collapse
-
#url(source_url, options = {}) ⇒ Object
The URL that you’d like smoke to source its data from You can also set the type for silly servers that don’t set a correct content-type (Flickr!) Example: url “site.com/resource.json”, :type => :json.
Methods inherited from Origin
#conceal, #concealed?, #discard, #emit, #expose, #exposed?, #initialize, #insert, #keep, #method_missing, #output, #path, #prepare, #rename, #reverse, #sort, #transform, #truncate
Constructor Details
This class inherits a constructor from Smoke::Origin
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Smoke::Origin
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
21 22 23 |
# File 'lib/smoke/source/data.rb', line 21 def request @request end |
Instance Method Details
#url(source_url, options = {}) ⇒ Object
The URL that you’d like smoke to source its data from You can also set the type for silly servers that don’t set a correct content-type (Flickr!) Example:
url "http://site.com/resource.json", :type => :json
27 28 29 |
# File 'lib/smoke/source/data.rb', line 27 def url(source_url, = {}) @url, @options = source_url, end |