{"action":"created","issue":{"url":"https://api.github.com/repos/plexus/yaks/issues/47","labels_url":"https://api.github.com/repos/plexus/yaks/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/plexus/yaks/issues/47/comments","events_url":"https://api.github.com/repos/plexus/yaks/issues/47/events","html_url":"https://github.com/plexus/yaks/issues/47","id":58585740,"number":47,"title":"First example in README crashes","user":{"login":"solnic","id":1066,"avatar_url":"https://avatars.githubusercontent.com/u/1066?v=3","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-23T13:34:10Z","updated_at":"2015-02-23T14:11:03Z","closed_at":null,"body":"Getting:\r\n\r\n```\r\nconst_get': uninitialized constant Kernel::LoadedMapper\r\n```"},"comment":{"url":"https://api.github.com/repos/plexus/yaks/issues/comments/75546494","html_url":"https://github.com/plexus/yaks/issues/47#issuecomment-75546494","issue_url":"https://api.github.com/repos/plexus/yaks/issues/47","id":75546494,"user":{"login":"plexus","id":32212,"avatar_url":"https://avatars.githubusercontent.com/u/32212?v=3","gravatar_id":"","url":"https://api.github.com/users/plexus","html_url":"https://github.com/plexus","followers_url":"https://api.github.com/users/plexus/followers","following_url":"https://api.github.com/users/plexus/following{/other_user}","gists_url":"https://api.github.com/users/plexus/gists{/gist_id}","starred_url":"https://api.github.com/users/plexus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plexus/subscriptions","organizations_url":"https://api.github.com/users/plexus/orgs","repos_url":"https://api.github.com/users/plexus/repos","events_url":"https://api.github.com/users/plexus/events{/privacy}","received_events_url":"https://api.github.com/users/plexus/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T14:11:03Z","updated_at":"2015-02-23T14:11:03Z","body":"Mappers are very central to Yaks. You can feed it hashes if you like, but you'll still have to specify which attributes, links, associations, forms, you want to generate.\r\n\r\nIf you just want to generically map the attributes in a hash (or something that responds to `[]`) you can do something like this\r\n\r\n```\r\nclass HashMapper < Yaks::Mapper\r\n  def load_attribute(name)\r\n    object[name]\r\n  end\r\n\r\n  def attributes\r\n    object.keys\r\n  end\r\nend\r\n\r\nyaks.call(data, mapper: HashMapper)\r\n```\r\n\r\nBut you might want to go straight to creating `Yaks::Resource` objects. The mapper layer is a DSL to create factories that take a specific type of input and create a `Yaks::Resource`. You can opt out of that DSL and generate a Resource directly, then serialize that.\r\n\r\n```\r\nyaks = Yaks.new do\r\n  skip :map \r\nend\r\n\r\nyaks.call(Yaks::Resource.new(attributes: your_hash))\r\n```\r\n\r\n(all code above untested :) )"}}