Ruby and Sinatra's Shotgun Wedding

2,373 views

Published on

A presentation for Barcamp Nashville 2011 by @jaminguy

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,373
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Ruby and Sinatra's Shotgun Wedding

    1. 1. Ruby and Sinatra’sshotgun wedding @jaminguy #bcn11
    2. 2. Overview• WTF is REST?• Sinatra and Ruby• Case Study (0_0)• Q &A
    3. 3. WTF is REST?• Created in 2000 by Roy Fielding in his doctoral dissertation• Representational state transfer• WWW is largest implementation of REST
    4. 4. Ummm... The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. “today’s weather in Los Angeles”), a collection of other resources, a non-virtual object (e.g. a person), and so on. In other words, any concept that might be the target of an author’s hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2_1_1
    5. 5. WTF?RESTful applications maximize theuse of the pre-existing, well-definedinterface and other built-incapabilities provided by the chosennetwork protocol, and minimizethe addition of new application-specific features on top of it. http://en.wikipedia.org/wiki/REST
    6. 6. Oooo shiny!
    7. 7. HTTP is RESTful!• Methods (verbs) GET, PUT, POST, DELETE• URIs (nouns) map entities to endpoints• Use response codes for success/error 200 OK (content is in response body) 204 No Content 404 Not Found 500 Internal Server Error
    8. 8. and Sinatra!• Sinatra is a DSL for quickly creating web applications in Ruby # myapp.rb require rubygems require sinatra get / do Hello world! end
    9. 9. get / do .. show something ..endpost / do .. create something ..endput / do .. replace something ..enddelete / do .. annihilate something ..end
    10. 10. • http://about.me/jaminguy• http://bitly.com/bundles/jaminguy/2

    ×