{"id":13509346,"url":"https://github.com/edubkendo/kitsune","last_synced_at":"2025-04-15T06:31:56.444Z","repository":{"id":24898923,"uuid":"28315377","full_name":"edubkendo/kitsune","owner":"edubkendo","description":"An Elixir library for transforming the representation of data","archived":false,"fork":false,"pushed_at":"2014-12-23T10:38:00.000Z","size":240,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T09:34:36.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edubkendo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-21T22:22:25.000Z","updated_at":"2020-02-23T14:58:58.000Z","dependencies_parsed_at":"2022-08-23T08:10:50.263Z","dependency_job_id":null,"html_url":"https://github.com/edubkendo/kitsune","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubkendo%2Fkitsune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubkendo%2Fkitsune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubkendo%2Fkitsune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubkendo%2Fkitsune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edubkendo","download_url":"https://codeload.github.com/edubkendo/kitsune/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223664777,"owners_count":17182181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:01:06.458Z","updated_at":"2024-11-08T09:47:30.889Z","avatar_url":"https://github.com/edubkendo.png","language":"CSS","funding_links":[],"categories":["Text and Numbers"],"sub_categories":[],"readme":"Kitsune\n=======\n\n\u003eA kitsune is a shapeshifter, and usually when it reaches the age of 100 years, it learn the ability to take on a human form. Thus, they have to be a fox for a hundred years before it can shapeshift from a fox to a human and back again. It is also said that a kitsune can duplicate other human beings, in other words shapeshift into the look-a-likes of different people.\n\n-- http://www.mythicalcreaturesguide.com/page/Kitsune\n\nKitsune is an Elixir library for transforming the representation of data inspired by [Representable](https://github.com/apotonick/representable/).\n\n\n## Examples\n\n### Properties\n\n```elixir\n    defmodule Person do\n      defstruct name: nil, age: nil\n    end\n\n    defmodule PersonRepresenter do\n      use Kitsune.JSON\n\n      property :name\n      property :age\n    end\n\n    person = %Person{name: \"Nikki\", age: 18}\n    PersonRepresenter.to_json(person)\n    #=\u003e \"{\\\"name\\\":\\\"Nikki\\\",\\\"age\\\":18}\"\n\n    json = \"{\\\"name\\\":\\\"Nikki\\\",\\\"age\\\":18}\"\n    PersonRepresenter.from_json(json, Person)\n    #=\u003e %Person{ name: \"Nikki\", age: 18 }\n```\n\nIf your property doesn't match the name of the key in the Struct, use `as`.\n\n```elixir\n\n      defmodule Song do\n        defstruct name: nil\n      end\n\n      defmodule SongRepresenter do\n        use Kitsune.JSON\n\n        property :title, as: :name\n      end\n\n      song = %Song{name: \"Gin and Juice\"}\n      SongRepresenter.to_json(song)\n      #=\u003e \"{\\\"title\\\":\\\"Gin and Juice\\\"}\"\n\n      json = \"{\\\"title\\\":\\\"Gin and Juice\\\"}\"\n      SongRepresenter.from_json(json, Song)\n      #=\u003e %Song{name: \"Gin and Juice\"}\n\n```\n### Collections\n\nYou can use collections to create collections of representations inside representations.\n\n```elixir\n\n    defmodule Album do\n      defstruct name: nil, songs: []\n    end\n\n    defmodule AlbumRepresenter do\n      use Kitsune.JSON\n\n      property :name\n      collection :songs, extend: SongRepresenter, from: Song\n    end\n\n    album = %Album{name: \"Doggystyle\", songs: [song, %Song{name: \"Lodi Dodi\"}]}\n    AlbumRepresenter.to_json(album)\n    #=\u003e \"{\\\"name\\\":\\\"Doggystyle\\\",\\\"songs\\\":[{\\\"title\\\":\\\"Gin and Juice\\\"},{\\\"title\\\":\\\"Lodi Dodi\\\"}]}\"\n\n    json = \"{\\\"name\\\":\\\"Doggystyle\\\",\\\"songs\\\":[{\\\"title\\\":\\\"Gin and Juice\\\"},{\\\"title\\\":\\\"Lodi Dodi\\\"}]}\"\n    AlbumRepresenter.from_json(json, Album)\n    #=\u003e %Album{name: \"Doggystyle\", songs: [%Song{name: \"Gin and Juice\"}, %Song{name: \"Lodi Dodi\"}]}\n\n```\n\n## Other\n\n- [Docs](http://hexdocs.pm/kitsune/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubkendo%2Fkitsune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedubkendo%2Fkitsune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubkendo%2Fkitsune/lists"}