Hypermicrodata client

author

Kunihiko Ito

institution

永和システムマネジメント

presentation-date

2014/11/29

allotted-time

5m

はじめに

Ruby Kaigi 2014 参加しました?

今日話すこと

参加しました?

Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails

聞いていない方

はじめまして

概要

Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails

hypermicrodata

あらためて

感じたこと

実際に作ってみよう!

show.html.haml

.person{itemscope: true, itemtype: 'http://schema.org/Person',
        itemid: users_url(@user), data: {main_item: true}}
  .media
    .media-body
  %p#notice= notice
  %p
    %strong Name:
    %span{itemprop: 'name'}= @user.name
  %p
    %strong Email:
    %span{itemprop: 'email'}= @user.email
  = link_to 'Edit', edit_user_path(@user), rel: 'edit'
  |
  \#{link_to 'Back', users_path, rel: 'collection', itemprop: 'isPartOf'}

{: lang=“haml”}

uber+json

{
   "uber":{
      "version":"1.0",
      "data":[
         {
            "url":"http://localhost:3000/users.1",
            "name":"Person",
            "data":[
               {
                  "name":"name",
                  "value":"Kunihiko Ito"
               },
               {
                  "name":"email",
                  "value":"kuni.110.92@gmail.com"
               },
               {
                  "name":"isPartOf",
                  "rel":"collection",
                  "url":"/users"
               },
               {
                  "rel":"edit",
                  "url":"/users/1/edit"
               }
            ]
         }
      ]
   }
}

アイディア

クライアントが hypermicrodata と 同じルールで読みとれれば 簡単に作れるようになるのでは?

やってみて

hypermicrodata client

みなさんも挑戦してみて下さい