Skip to content

Instantly share code, notes, and snippets.

@fanktom
Created September 23, 2012 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanktom/3772781 to your computer and use it in GitHub Desktop.
Save fanktom/3772781 to your computer and use it in GitHub Desktop.
Scales API Push
@html = "<html><head></head><body><p>Hello World</p></body></html>"
@xml = "<tracks><track><name>Islandary</name><artist>Thomas Fankhauser</artist></track></tracks>"
@json = '[{ name : "Islandary", artist : "Thomas Fankhauser" }]'
# Push a HTML
Scales.push :html => @html, :to => "/hello"
# Push a XML
Scales.push :xml => @xml, :to => "/hello.xml"
# Push a JSON
Scales.push :json => @json, :to => "/hello.json"
# Push an Image (PNG)
Scales.push :png => IO.read("path/to/image.png"), :to => "/hello.png"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment