Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Webmachine (Ruby)

Webmachine (Ruby)

presented on KRUG

Fcc3bb4ff848693a7532e74299aba106?s=128

Paweł Pacana

March 12, 2013
Tweet

Transcript

  1. WEBMACHINE THE HTTP TOOLKIT IN RUBY @pawelpacana

  2. I’m not a native speaker DISCLAIMER

  3. HTTP 1.1 SPEC RFC2616

  4. TOOLKIT • „A toolkit for easily creating well- behaved HTTP

    applications” • not a framework • Sinatra vs. Rails • extracted from Riak
  5. RACK INTERFACE app = proc { |env| [ 200, #

    Status {'Content-Type' => 'text/plain'}, # Headers ["Hello World!"] # Body ] }
  6. RACK MIDDLEWARE • Head, ContentLength, ContentType, Deflater, …

  7. HTTP IS HARD

  8. WEBMACHINE • FSM modelling HTTP • negotiate hard decisions transparently

  9. HTTP IS RESOURCES • data or service • identified by

    URI • representations
  10. WEBMACHINE • resources as a core building block • declare

    resources, don’t perform actions • resource callbacks
  11. EXAMPLES show me the code

  12. ADAPTERS • WEBrick • Mongrel • Rack* • Reel •

    Hatetepe
  13. ECOSYSTEM • webmachine-test • webmachine-linking • webmachine-actionview • webmachine-sprockets •

    irwebmachine
  14. MY OBSERVATIONS • good as HTTP content delivery mechanism in

    Ports and Adapters architecture • good for Hypermedia APIs • small enough to read and trust it
  15. GOING DEEPER http://bit.ly/resources-for-real-this-time

  16. THANK YOU @pawelpacana

  17. DRUG #40 NEXT MONDAY 19:00 http://drug.org.pl