{"id":14955986,"url":"https://github.com/servactory/datory","last_synced_at":"2025-10-23T22:24:15.314Z","repository":{"id":234880301,"uuid":"789374214","full_name":"servactory/datory","owner":"servactory","description":"Ruby serializer and deserializer","archived":false,"fork":false,"pushed_at":"2025-08-23T07:52:22.000Z","size":215,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-23T12:07:48.965Z","etag":null,"topics":["deserialization","dto","rails","ruby","ruby-on-rails","serialization"],"latest_commit_sha":null,"homepage":"https://datory.servactory.com","language":"Ruby","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/servactory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-20T11:16:34.000Z","updated_at":"2025-08-23T07:52:08.000Z","dependencies_parsed_at":"2024-04-23T12:53:57.194Z","dependency_job_id":"bc3000ca-2fd9-4da8-86a8-55825f5c19a3","html_url":"https://github.com/servactory/datory","commit_stats":{"total_commits":117,"total_committers":2,"mean_commits":58.5,"dds":0.008547008547008517,"last_synced_commit":"f0c396c9746d58b479d019f51dd7380bca77a72c"},"previous_names":["servactory/datory"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/servactory/datory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servactory%2Fdatory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servactory%2Fdatory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servactory%2Fdatory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servactory%2Fdatory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/servactory","download_url":"https://codeload.github.com/servactory/datory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/servactory%2Fdatory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274595362,"owners_count":25314017,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["deserialization","dto","rails","ruby","ruby-on-rails","serialization"],"created_at":"2024-09-24T13:12:08.075Z","updated_at":"2025-10-23T22:24:10.261Z","avatar_url":"https://github.com/servactory.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://servactory.com\" target=\"_blank\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/servactory/datory/main/.github/logo-dark.svg\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/servactory/datory/main/.github/logo-light.svg\"\u003e\n      \u003cimg alt=\"Datory\" src=\"https://raw.githubusercontent.com/servactory/datory/main/.github/logo-light.svg\" width=\"350\" height=\"70\" style=\"max-width: 100%;\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://rubygems.org/gems/datory\"\u003e\u003cimg src=\"https://img.shields.io/gem/v/datory?logo=rubygems\u0026logoColor=fff\" alt=\"Gem version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/servactory/datory/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release-date/servactory/datory\" alt=\"Release Date\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Documentation\n\nSee [datory.servactory.com](https://datory.servactory.com) for documentation.\n\n## Quick Start\n\n### Installation\n\n```ruby\ngem \"datory\"\n```\n\n### Usage\n\n#### Serialize\n\n```ruby\nserial = Serial.find(id)\n\nSerialDto.serialize(serial) # =\u003e { ... }\n```\n\n#### Deserialize\n\n```ruby\nSerialDto.deserialize(json) # =\u003e Datory::Result\n```\n\n#### Form\n\nFor serialization, the `form` method is also available.\nThis prepares a `Form` object, which has a set of additional methods such as `valid?` and `invalid?`.\n\n```ruby\nform = SerialDto.form(serial)\n\nform.target # =\u003e SerialDto\nform.model # =\u003e { ... }\n\nform.valid? # =\u003e true\nform.invalid? # =\u003e false\n\nform.serialize # =\u003e { ... }\n```\n\n#### Examples\n\n```ruby\nclass SerialDto \u003c Datory::Base\n  uuid! :id\n\n  string! :status\n  string! :title\n\n  one! :poster, include: ImageDto\n\n  one! :ratings, include: RatingsDto\n\n  many! :countries, include: CountryDto\n  many! :genres, include: GenreDto\n  many! :seasons, include: SeasonDto\n\n  date! :premieredOn, to: :premiered_on\nend\n```\n\n```ruby\nclass SeasonDto \u003c Datory::Base\n  uuid! :id\n  uuid! :serialId, to: :serial_id\n\n  integer! :number\n\n  many! :episodes, include: EpisodeDto\n\n  date! :premieredOn, to: :premiered_on\n  date? :endedOn, to: :ended_on\nend\n```\n\n## Attribute declaration\n\nUsing the `!` sign means that the attribute is required.\nThe optionality of an attribute is indicated using the `?` sign.\n\n### Basic\n\n#### attribute\n\n```ruby\nattribute :uuid, from: String, to: :id, as: String, format: :uuid\n```\n\n#### string!\n\n```ruby\nstring! :uuid, to: :id\n```\n\n#### integer!\n\n```ruby\ninteger! :rating, min: 1, max: 10\n```\n\n#### float!\n\n```ruby\nfloat! :rating\n```\n\n#### boolean!\n\n```ruby\nboolean! :default\n```\n\n### Helpers\n\n#### uuid!\n\nIt will also check that the value matches the UUID format.\n\n```ruby\nuuid! :id\n```\n\n#### money!\n\nIt will prepare two attributes `*_cents` and `*_currency`.\n\n```ruby\nmoney! :box_office\n```\n\n#### duration!\n\n```ruby\nduration! :episode_duration\n```\n\n#### date!\n\n```ruby\ndate! :premiered_on\n```\n\n#### time!\n\n```ruby\ntime! :premiered_at\n```\n\n#### datetime!\n\n```ruby\ntime! :premiered_at\n```\n\n### Nesting\n\n#### one!\n\n```ruby\none! :poster, include: ImageDto\n```\n\n#### many!\n\n```ruby\nmany! :seasons, include: SeasonDto\n```\n\n## Object information\n\n### Info\n\n```ruby\nSerialDto.info\n```\n\n```\n#\u003cDatory::Info::Result:0x0000000128a33c38 @attributes={:id=\u003e{:from=\u003e{:name=\u003e:id, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003e:uuid}, :to=\u003e{:name=\u003e:id, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003e:uuid, :required=\u003etrue, :default=\u003enil, :include=\u003enil}}, :status=\u003e{:from=\u003e{:name=\u003e:status, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil}, :to=\u003e{:name=\u003e:status, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003enil}}, :title=\u003e{:from=\u003e{:name=\u003e:title, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil}, :to=\u003e{:name=\u003e:title, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003enil}}, :poster=\u003e{:from=\u003e{:name=\u003e:poster, :type=\u003e[Usual::Example1::Image, Hash], :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil}, :to=\u003e{:name=\u003e:poster, :type=\u003e[Usual::Example1::Image, Hash], :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003eUsual::Example1::Image}}, :ratings=\u003e{:from=\u003e{:name=\u003e:ratings, :type=\u003e[Usual::Example1::Ratings, Hash], :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil}, :to=\u003e{:name=\u003e:ratings, :type=\u003e[Usual::Example1::Ratings, Hash], :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003eUsual::Example1::Ratings}}, :countries=\u003e{:from=\u003e{:name=\u003e:countries, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Country, Hash], :format=\u003enil}, :to=\u003e{:name=\u003e:countries, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Country, Hash], :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003eUsual::Example1::Country}}, :genres=\u003e{:from=\u003e{:name=\u003e:genres, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Genre, Hash], :format=\u003enil}, :to=\u003e{:name=\u003e:genres, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Genre, Hash], :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003eUsual::Example1::Genre}}, :seasons=\u003e{:from=\u003e{:name=\u003e:seasons, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Season, Hash], :format=\u003enil}, :to=\u003e{:name=\u003e:seasons, :type=\u003eArray, :min=\u003enil, :max=\u003enil, :consists_of=\u003e[Usual::Example1::Season, Hash], :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003eUsual::Example1::Season}}, :premieredOn=\u003e{:from=\u003e{:name=\u003e:premieredOn, :type=\u003eString, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003e:date}, :to=\u003e{:name=\u003e:premiered_on, :type=\u003eDate, :min=\u003enil, :max=\u003enil, :consists_of=\u003efalse, :format=\u003enil, :required=\u003etrue, :default=\u003enil, :include=\u003enil}}}\u003e\n```\n\n### Describe\n\nAlias: `table`\n\n```ruby\nSerialDto.describe\n```\n\n```\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n|                                         SerialDto                                         |\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n| Attribute   | From                         | To                 | As         | Include    |\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n| id          | String                       | id                 | String     |            |\n| status      | String                       | status             | String     |            |\n| title       | String                       | title              | String     |            |\n| poster      | [ImageDto, Hash]   | poster  | [ImageDto, Hash]   | ImageDto   |            |\n| ratings     | [RatingsDto, Hash] | ratings | [RatingsDto, Hash] | RatingsDto |            |\n| countries   | Array                        | countries          | Array      | CountryDto |\n| genres      | Array                        | genres             | Array      | GenreDto   |\n| seasons     | Array                        | seasons            | Array      | SeasonDto  |\n| premieredOn | String                       | premiered_on       | Date       |            |\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n```\n\n## Contributing\n\nThis project is intended to be a safe, welcoming space for collaboration. \nContributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. \nWe recommend reading the [contributing guide](./CONTRIBUTING.md) as well.\n\n## License\n\nDatory is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservactory%2Fdatory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservactory%2Fdatory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservactory%2Fdatory/lists"}