Skip to content

Instantly share code, notes, and snippets.

@Odaeus
Created June 7, 2016 11:10
Show Gist options
  • Save Odaeus/578ee6267427861c4422a1fccd8296df to your computer and use it in GitHub Desktop.
Save Odaeus/578ee6267427861c4422a1fccd8296df to your computer and use it in GitHub Desktop.
require "yaks"
Book = Struct.new(:title, :author)
book = Book.new("Leviathan Wakes", "James A Corey")
class BookMapper < Yaks::Mapper
type "book"
attributes :title
end
yaks = Yaks.new do
default_format :json_api
end
puts yaks.call(book)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment