SlideShare a Scribd company logo
cURLin' for Docs
    Eric Oestrich
    @ericoestrich
      oestri.ch
Say what?
$ curl -H "Accept: text/docs+plain"
http://rad-example.herokuapp.com/orders
Example
Getting a list of orders
------------------------

Parameters:
  * page - Current page of orders
Request
Request:
  GET /orders?page=1
  Accept: application/json
  Content-Type: application/json
  Cookie:
  Host: example.org

  page=1
Response
Response:
  Status: 200 OK
  Cache-Control: max-age=0, private, must-revalidate
  Content-Length: 121
  Content-Type: application/json; charset=utf-8
  ETag: "6cd5831e98b0090b64672b5604d9eb2a"
  X-Runtime: 0.019010
  X-UA-Compatible: IE=Edge,chrome=1

  [{"email":"email0@example.com","name":"Order 0","paid":
true},{"email":"email1@example.com","name":"Order 1","
paid":true}]
Neat-o, how do I get that?
Install some gems
Gemfile

group :test do
  gem 'rspec_api_documentation'
  gem 'raddocs'
end
Write RAD tests
spec/acceptance/orders_spec.rb

resource "Orders" do
  get "/orders" do
    it "should ..." do
      ...
    end
  end
end
Configure the output formats
spec/spec_helper.rb

RspecApiDocumentation.configure do |config|
  config.formats = [:json, :combined_text]
end
Generate docs
$ rake docs:generate
Mount Raddocs
config/routes.rb

Application.routes.draw do
  resources :orders

  match "/docs" => Raddocs::App,
    :anchor => false
end
Use Raddocs::Middleware
config/application.rb

module Example
  class Application < Rails::Application
    ...
    config.middleware.use "Raddocs::Middleware"
    ...
  end
end
cURL Away
$ curl -H "Accept: text/docs+plain"
      http://localhost/orders
Demo
Gems
● rspec_api_documentation
  ○   http://github.com/zipmark/rspec_api_documentation
● raddocs
  ○   http://github.com/oestrich/raddocs
Questions?

More Related Content

PDF
RESTing with the new Yandex.Disk API, Clemens Аuer
PDF
Inside MongoDB: the Internals of an Open-Source Database
PDF
Latinoware
KEY
Composing re-useable ETL on Hadoop
ODP
Python and MongoDB
PDF
Indexing
PPTX
Peggy elasticsearch應用
PPTX
Back to Basics Webinar 5: Introduction to the Aggregation Framework
RESTing with the new Yandex.Disk API, Clemens Аuer
Inside MongoDB: the Internals of an Open-Source Database
Latinoware
Composing re-useable ETL on Hadoop
Python and MongoDB
Indexing
Peggy elasticsearch應用
Back to Basics Webinar 5: Introduction to the Aggregation Framework

What's hot (20)

PPTX
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
ODP
Introduction to MongoDB with PHP
PDF
HTTP 완벽가이드- 13 다이제스트 인증
PPTX
Aggregation in MongoDB
PPTX
MongoDB's New Aggregation framework
PPTX
“Elasticsearch for .NET developers”
PPTX
Back to Basics: My First MongoDB Application
PDF
Aggregation Framework MongoDB Days Munich
PDF
Nodejs meetup-12-2-2015
PDF
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
PDF
Elastic search 검색
ODP
Aggregation Framework in MongoDB Overview Part-1
PDF
はじめてのMongoDB
PDF
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
PDF
NoSQL - An introduction to CouchDB
PDF
The emerging world of mongo db csp
PDF
Mongo db for c# developers
KEY
Mongo db presentation
PDF
Mongo db for C# Developers
ODP
MongoDB & PHP
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Introduction to MongoDB with PHP
HTTP 완벽가이드- 13 다이제스트 인증
Aggregation in MongoDB
MongoDB's New Aggregation framework
“Elasticsearch for .NET developers”
Back to Basics: My First MongoDB Application
Aggregation Framework MongoDB Days Munich
Nodejs meetup-12-2-2015
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
Elastic search 검색
Aggregation Framework in MongoDB Overview Part-1
はじめてのMongoDB
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
NoSQL - An introduction to CouchDB
The emerging world of mongo db csp
Mongo db for c# developers
Mongo db presentation
Mongo db for C# Developers
MongoDB & PHP
Ad

Viewers also liked (6)

PDF
(Www.entrance exam.net)-hcl placement sample paper 3
PPT
Univa Introduction
PDF
Digital Identity: Content Sharing and the Balance of Power
PPS
Відкриті дані до ваших послуг!
DOC
CV_Sudhindra Srinivasamurthy
PDF
Copywriting conspiracylores
(Www.entrance exam.net)-hcl placement sample paper 3
Univa Introduction
Digital Identity: Content Sharing and the Balance of Power
Відкриті дані до ваших послуг!
CV_Sudhindra Srinivasamurthy
Copywriting conspiracylores
Ad

Similar to Curlin' for Docs (20)

PPT
KEY
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
PDF
Jordi Romero Api for-the-mobile-era
KEY
Using and scaling Rack and Rack-based middleware
PDF
Demystifying REST - SFRails meetup
PDF
Api Design and More (Friday Training at Itnig)
PPTX
Women Who Code - RSpec JSON API Workshop
PDF
From zero to almost rails in about a million slides...
PDF
Swagger Rails: The Right Guide For You..
KEY
Rails web api 开发
PPT
Streamlined Geek Talk
PPTX
Next Level Curl
PDF
Building sustainable RESTFul services
PDF
Finding Restfulness - Madrid.rb April 2014
PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
PDF
Chloe and the Realtime Web
PDF
Introduction to RDoc
PDF
Introduction to RDoc
PDF
Broom not included curling the modern way
PPTX
REST with Eve and Python
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
Jordi Romero Api for-the-mobile-era
Using and scaling Rack and Rack-based middleware
Demystifying REST - SFRails meetup
Api Design and More (Friday Training at Itnig)
Women Who Code - RSpec JSON API Workshop
From zero to almost rails in about a million slides...
Swagger Rails: The Right Guide For You..
Rails web api 开发
Streamlined Geek Talk
Next Level Curl
Building sustainable RESTFul services
Finding Restfulness - Madrid.rb April 2014
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Chloe and the Realtime Web
Introduction to RDoc
Introduction to RDoc
Broom not included curling the modern way
REST with Eve and Python

More from SmartLogic (20)

PDF
Writing Game Servers with Elixir
PDF
All Aboard The Stateful Train
PDF
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
PDF
Monitoring Your Elixir Application with Prometheus
PDF
Going Multi-Node
PPTX
Kubernetes and docker
PDF
Serializing Value Objects-Ara Hacopian
PDF
Guide to food foraging by SmartLogic's Kei Ellerbrock
PDF
Introduction to Type Script by Sam Goldman, SmartLogic
PDF
How SmartLogic Uses Chef-Dan Ivovich
PPTX
A Few Interesting Things in Apple's Swift Programming Language
PDF
Effective ActiveRecord
PDF
An Introduction to Reactive Cocoa
PDF
iOS Development Methodology
PPT
CSS Preprocessors to the Rescue!
PDF
Deploying Rails Apps with Chef and Capistrano
PDF
From Slacker to Hacker, Practical Tips for Learning to Code
PDF
The Language of Abstraction in Software Development
PDF
Android Testing: An Overview
PPTX
Intro to DTCoreText: Moving Past UIWebView | iOS Development
Writing Game Servers with Elixir
All Aboard The Stateful Train
DC |> Elixir Meetup - Going off the Rails into Elixir - Dan Ivovich
Monitoring Your Elixir Application with Prometheus
Going Multi-Node
Kubernetes and docker
Serializing Value Objects-Ara Hacopian
Guide to food foraging by SmartLogic's Kei Ellerbrock
Introduction to Type Script by Sam Goldman, SmartLogic
How SmartLogic Uses Chef-Dan Ivovich
A Few Interesting Things in Apple's Swift Programming Language
Effective ActiveRecord
An Introduction to Reactive Cocoa
iOS Development Methodology
CSS Preprocessors to the Rescue!
Deploying Rails Apps with Chef and Capistrano
From Slacker to Hacker, Practical Tips for Learning to Code
The Language of Abstraction in Software Development
Android Testing: An Overview
Intro to DTCoreText: Moving Past UIWebView | iOS Development

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Curlin' for Docs