Use the space bar or arrow keys to browse the slide.
Some of the images are pretty big, so if you see an empty slide then wait a bit.

A library for building APIs
It serializes objects
It’s specialized in Hypermedia
customer = Customer.find(27)
yaks = Yaks.new
json = yaks.call(
customer,
mapper: CustomerMapper,
env: rack_env
)
class CustomerMapper < Yaks::Mapper
attributes :first_name, :last_name, :age
def age
Date.today - customer.date_of_birth
end
link :self, '/api/customer/{id}'
link :orders, '/api/customer/{id}/orders',
if: -> { is_logged_in_customer? }
end
Three main name spaces
Yaks::Mapper*
Yaks::Resource*
Yaks::Format*
Very flexible and configurable
Central representation Yaks::Resource
Yaks::Resource.new(
type: "customer",
attributes: {
first_name: "Arne",
last_name: "Brasseur"
},
links: [
Yaks::Resource::Link.new(rel: :self, uri: "/customer/5")
],
forms: [
Yaks::Resource::Form.new(...)
]
)
Turned into many output formats: HAL, JSON API, Collection+JSON, HTML, HALO, Transit
Building hypermedia API + Ember app for Ticketsolve
No existing libraries fitted the bill
Developing in the open would improve quality
Still young, small but friendly
Github issues, Gitter chat
Main contributions: improvements to specific formats
Use it! report back!
Scratch your own itch
Coding and non-coding skills needed
Recent focus: improving mutation coverage
Improve support for various formats
Better docs, examples
Several issues marked ROSSConf
or Beginner Friendly in Github
Ruby / HTML / CSS task
Fun task because creative and immediate feedback
Tests code examples in documentation
8 out of 30 currently fail
Cool because you learn a useful new tool
Turn this
class FooMapper < Yaks::Mapper
attributes :bar
def bar
object.baz
end
end
into
class FooMapper < Yaks::Mapper
attribute :bar do
object.baz
end
end
JSON-based format that’s becoming popular
Maps very well to Yaks’s abstractions
Great for learning about how Yaks works