Introduction to Hypermedia APIs with Rails Presentation

Posted on 06 Sep 2012 by Eric Oestrich

Last week SmartLogic had an internal conference where I gave a presentation on hypermedia APIs with Rails, located here. I created an example app that's on github. My favorite part about this talk was at the end when I attempted to change the routes the app serves up and see if my hal client still worked. It passed with flying colors.

I used the frenetic gem to create my hal client. It's pretty verbose currently and let's just gloss over all those periods. It's a nice starting point for a HAL api.

require 'frenetic'

MyAPI ={
  'url'          => '',
  'username'     => 'qxpRbQpqAw3YugKUpErW',
  'password'     => 'qxpRbQpqAw3YugKUpErW',
  'headers' => {
    'accept' => 'application/hal+json'

class Order < Frenetic::Resource
  api_client { MyAPI }

  def self.orders
    api.get(api.description.links.orders.href) do |order|

p Order.orders


comments powered by Disqus
Eric Oestrich
I am:
All posts
Creative Commons License
This site's content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License unless otherwise specified. Code on this site is licensed under the MIT License unless otherwise specified.