{"action":"created","comment":{"url":"https://api.github.com/repos/nesaulov/surrealist/pulls/comments/148095768","pull_request_review_id":73286182,"id":148095768,"diff_hunk":"@@ -99,8 +141,97 @@ class Genre < ActiveRecord::Base\n   json_schema { { name: String } }\n end\n \n-3.times { Genre.create(name: ('a'..'z').to_a.sample(8).join) }\n-3.times { Author.create(name: ('a'..'z').to_a.sample(8).join) }\n-3.times { Book.create(name: ('a'..'z').to_a.sample(8).join, genre_id: Genre.all.sample.id) }\n-3.times { Publisher.create(name: ('a'..'z').to_a.sample(8).join, book_id: Book.all.sample.id) }\n-3.times { Award.create(name: ('a'..'z').to_a.sample(8).join, book_id: Book.all.sample.id) }\n+class Executive < ActiveRecord::Base\n+  has_one :assistant\n+\n+  include Surrealist\n+\n+  json_schema { { name: String, assistant: Object } }\n+end\n+\n+class Assistant < ActiveRecord::Base\n+  belongs_to :executive\n+\n+  include Surrealist\n+\n+  json_schema { { name: String, executive: Executive } }\n+end\n+\n+class Manager < ActiveRecord::Base\n+  has_many :employees\n+  belongs_to :executive\n+\n+  include Surrealist\n+\n+  json_schema { { name: String } }\n+end\n+\n+class Employee < ActiveRecord::Base\n+  belongs_to :manager\n+\n+  include Surrealist\n+\n+  json_schema { { name: String, manager: Manager } }\n+end\n+\n+class PromKing < ActiveRecord::Base\n+  belongs_to :prom_couple\n+  has_one :prom, through: :prom_couple\n+\n+  include Surrealist\n+\n+  json_schema { { prom_king_name: String, prom: Object } }\n+end\n+\n+class PromCouple < ActiveRecord::Base\n+  belongs_to :prom\n+  has_one :prom_king\n+\n+  include Surrealist\n+\n+  json_schema { { prom_king: PromKing, prom_queen: String } }\n+end\n+\n+class Prom < ActiveRecord::Base\n+  has_one :prom_couple\n+\n+  include Surrealist\n+\n+  json_schema { { prom_name: String, prom_couple: PromCouple } }\n+end\n+\n+class Question < ActiveRecord::Base\n+  has_many :answers\n+\n+  include Surrealist\n+\n+  json_schema { { name: String, answers: Object } }\n+end\n+\n+class Answer < ActiveRecord::Base\n+  belongs_to :question\n+\n+  include Surrealist\n+\n+  json_schema { { name: String, question: Question } }\n+end\n+\n+def name_string\n+  ('a'..'z').to_a.sample(8).join\n+end\n+\n+3.times { Genre.create(name: name_string) }\n+3.times { Author.create(name: name_string, books: Book.all.sample(3)) }\n+3.times { Book.create(name: name_string, genre_id: Genre.all.sample.id, authors: Author.all.sample(3)) }","path":"spec/orms/ar.rb","position":142,"original_position":142,"commit_id":"e605b54c1ca5537952fae3f9b0fcebbfa4bf44ef","original_commit_id":"e605b54c1ca5537952fae3f9b0fcebbfa4bf44ef","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Line is too long. [104/80]","created_at":"2017-10-31T18:55:33Z","updated_at":"2017-10-31T18:55:34Z","html_url":"https://github.com/nesaulov/surrealist/pull/34#discussion_r148095768","pull_request_url":"https://api.github.com/repos/nesaulov/surrealist/pulls/34","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/comments/148095768"},"html":{"href":"https://github.com/nesaulov/surrealist/pull/34#discussion_r148095768"},"pull_request":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/nesaulov/surrealist/pulls/34","id":146663238,"html_url":"https://github.com/nesaulov/surrealist/pull/34","diff_url":"https://github.com/nesaulov/surrealist/pull/34.diff","patch_url":"https://github.com/nesaulov/surrealist/pull/34.patch","issue_url":"https://api.github.com/repos/nesaulov/surrealist/issues/34","number":34,"state":"open","locked":false,"title":"Nested record surrealization","user":{"login":"AlessandroMinali","id":4143332,"avatar_url":"https://avatars3.githubusercontent.com/u/4143332?v=4","gravatar_id":"","url":"https://api.github.com/users/AlessandroMinali","html_url":"https://github.com/AlessandroMinali","followers_url":"https://api.github.com/users/AlessandroMinali/followers","following_url":"https://api.github.com/users/AlessandroMinali/following{/other_user}","gists_url":"https://api.github.com/users/AlessandroMinali/gists{/gist_id}","starred_url":"https://api.github.com/users/AlessandroMinali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlessandroMinali/subscriptions","organizations_url":"https://api.github.com/users/AlessandroMinali/orgs","repos_url":"https://api.github.com/users/AlessandroMinali/repos","events_url":"https://api.github.com/users/AlessandroMinali/events{/privacy}","received_events_url":"https://api.github.com/users/AlessandroMinali/received_events","type":"User","site_admin":false},"body":"Simple example:\r\n\r\n```\r\nclass Author\r\n  include Surrealist\r\n  json_schema { { name: String } }\r\nend\r\n\r\nclass Book\r\n  belongs_to :author\r\n  include Surrealist\r\n  json_schema { { name: String, author: Author } }\r\nend\r\n\r\nBook.first.surrealize #=> \"{ name: 'Something', author: { name: 'Stephen King' } }\"\r\n```\r\n\r\nComplicated Example:\r\n```\r\nclass Question < ActiveRecord::Base\r\n  has_many :answers\r\n\r\n  include Surrealist\r\n\r\n  json_schema { { name: String, answers: Object } }\r\nend\r\n\r\nclass Answer < ActiveRecord::Base\r\n  belongs_to :question\r\n\r\n  include Surrealist\r\n\r\n  json_schema { { name: String, question: Question } }\r\nend\r\n\r\nQuestion.first.build_schema # =>\r\n{\r\n  \"name\": \"qizwuvec\",\r\n  \"answers\": [\r\n    {\r\n      \"name\": \"wvpkeosi\",\r\n      \"question\": null\r\n    },\r\n    {\r\n      \"name\": \"lqmgtryu\",\r\n      \"question\": null\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nSupport nested and self referencing records. See specs for more examples.\r\n\r\n**TODO**:\r\n- [x] Support nested collection assocations\r\n- [x] Some parameter testing\r\n- [x] Inline DOCS\r\n- [x] README update\r\n\r\n@nesaulov ","created_at":"2017-10-15T18:54:57Z","updated_at":"2017-10-31T18:55:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a654f25db38974203ed0f48b89920c3ed89b7a28","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/nesaulov/surrealist/pulls/34/commits","review_comments_url":"https://api.github.com/repos/nesaulov/surrealist/pulls/34/comments","review_comment_url":"https://api.github.com/repos/nesaulov/surrealist/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nesaulov/surrealist/issues/34/comments","statuses_url":"https://api.github.com/repos/nesaulov/surrealist/statuses/e605b54c1ca5537952fae3f9b0fcebbfa4bf44ef","head":{"label":"AlessandroMinali:nested-record","ref":"nested-record","sha":"e605b54c1ca5537952fae3f9b0fcebbfa4bf44ef","user":{"login":"AlessandroMinali","id":4143332,"avatar_url":"https://avatars3.githubusercontent.com/u/4143332?v=4","gravatar_id":"","url":"https://api.github.com/users/AlessandroMinali","html_url":"https://github.com/AlessandroMinali","followers_url":"https://api.github.com/users/AlessandroMinali/followers","following_url":"https://api.github.com/users/AlessandroMinali/following{/other_user}","gists_url":"https://api.github.com/users/AlessandroMinali/gists{/gist_id}","starred_url":"https://api.github.com/users/AlessandroMinali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlessandroMinali/subscriptions","organizations_url":"https://api.github.com/users/AlessandroMinali/orgs","repos_url":"https://api.github.com/users/AlessandroMinali/repos","events_url":"https://api.github.com/users/AlessandroMinali/events{/privacy}","received_events_url":"https://api.github.com/users/AlessandroMinali/received_events","type":"User","site_admin":false},"repo":{"id":106018646,"name":"surrealist","full_name":"AlessandroMinali/surrealist","owner":{"login":"AlessandroMinali","id":4143332,"avatar_url":"https://avatars3.githubusercontent.com/u/4143332?v=4","gravatar_id":"","url":"https://api.github.com/users/AlessandroMinali","html_url":"https://github.com/AlessandroMinali","followers_url":"https://api.github.com/users/AlessandroMinali/followers","following_url":"https://api.github.com/users/AlessandroMinali/following{/other_user}","gists_url":"https://api.github.com/users/AlessandroMinali/gists{/gist_id}","starred_url":"https://api.github.com/users/AlessandroMinali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlessandroMinali/subscriptions","organizations_url":"https://api.github.com/users/AlessandroMinali/orgs","repos_url":"https://api.github.com/users/AlessandroMinali/repos","events_url":"https://api.github.com/users/AlessandroMinali/events{/privacy}","received_events_url":"https://api.github.com/users/AlessandroMinali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlessandroMinali/surrealist","description":"Surrealize Ruby objects according to your custom schema","fork":true,"url":"https://api.github.com/repos/AlessandroMinali/surrealist","forks_url":"https://api.github.com/repos/AlessandroMinali/surrealist/forks","keys_url":"https://api.github.com/repos/AlessandroMinali/surrealist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlessandroMinali/surrealist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlessandroMinali/surrealist/teams","hooks_url":"https://api.github.com/repos/AlessandroMinali/surrealist/hooks","issue_events_url":"https://api.github.com/repos/AlessandroMinali/surrealist/issues/events{/number}","events_url":"https://api.github.com/repos/AlessandroMinali/surrealist/events","assignees_url":"https://api.github.com/repos/AlessandroMinali/surrealist/assignees{/user}","branches_url":"https://api.github.com/repos/AlessandroMinali/surrealist/branches{/branch}","tags_url":"https://api.github.com/repos/AlessandroMinali/surrealist/tags","blobs_url":"https://api.github.com/repos/AlessandroMinali/surrealist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlessandroMinali/surrealist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlessandroMinali/surrealist/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlessandroMinali/surrealist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlessandroMinali/surrealist/statuses/{sha}","languages_url":"https://api.github.com/repos/AlessandroMinali/surrealist/languages","stargazers_url":"https://api.github.com/repos/AlessandroMinali/surrealist/stargazers","contributors_url":"https://api.github.com/repos/AlessandroMinali/surrealist/contributors","subscribers_url":"https://api.github.com/repos/AlessandroMinali/surrealist/subscribers","subscription_url":"https://api.github.com/repos/AlessandroMinali/surrealist/subscription","commits_url":"https://api.github.com/repos/AlessandroMinali/surrealist/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlessandroMinali/surrealist/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlessandroMinali/surrealist/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlessandroMinali/surrealist/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlessandroMinali/surrealist/contents/{+path}","compare_url":"https://api.github.com/repos/AlessandroMinali/surrealist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlessandroMinali/surrealist/merges","archive_url":"https://api.github.com/repos/AlessandroMinali/surrealist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlessandroMinali/surrealist/downloads","issues_url":"https://api.github.com/repos/AlessandroMinali/surrealist/issues{/number}","pulls_url":"https://api.github.com/repos/AlessandroMinali/surrealist/pulls{/number}","milestones_url":"https://api.github.com/repos/AlessandroMinali/surrealist/milestones{/number}","notifications_url":"https://api.github.com/repos/AlessandroMinali/surrealist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlessandroMinali/surrealist/labels{/name}","releases_url":"https://api.github.com/repos/AlessandroMinali/surrealist/releases{/id}","deployments_url":"https://api.github.com/repos/AlessandroMinali/surrealist/deployments","created_at":"2017-10-06T15:11:08Z","updated_at":"2017-10-06T15:11:09Z","pushed_at":"2017-10-31T18:55:19Z","git_url":"git://github.com/AlessandroMinali/surrealist.git","ssh_url":"git@github.com:AlessandroMinali/surrealist.git","clone_url":"https://github.com/AlessandroMinali/surrealist.git","svn_url":"https://github.com/AlessandroMinali/surrealist","homepage":"http://www.rubydoc.info/github/nesaulov/surrealist","size":173,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nesaulov:master","ref":"master","sha":"cf9cad5206aa55a3554fbb51666e82abf4704a4f","user":{"login":"nesaulov","id":20617394,"avatar_url":"https://avatars3.githubusercontent.com/u/20617394?v=4","gravatar_id":"","url":"https://api.github.com/users/nesaulov","html_url":"https://github.com/nesaulov","followers_url":"https://api.github.com/users/nesaulov/followers","following_url":"https://api.github.com/users/nesaulov/following{/other_user}","gists_url":"https://api.github.com/users/nesaulov/gists{/gist_id}","starred_url":"https://api.github.com/users/nesaulov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nesaulov/subscriptions","organizations_url":"https://api.github.com/users/nesaulov/orgs","repos_url":"https://api.github.com/users/nesaulov/repos","events_url":"https://api.github.com/users/nesaulov/events{/privacy}","received_events_url":"https://api.github.com/users/nesaulov/received_events","type":"User","site_admin":false},"repo":{"id":102661666,"name":"surrealist","full_name":"nesaulov/surrealist","owner":{"login":"nesaulov","id":20617394,"avatar_url":"https://avatars3.githubusercontent.com/u/20617394?v=4","gravatar_id":"","url":"https://api.github.com/users/nesaulov","html_url":"https://github.com/nesaulov","followers_url":"https://api.github.com/users/nesaulov/followers","following_url":"https://api.github.com/users/nesaulov/following{/other_user}","gists_url":"https://api.github.com/users/nesaulov/gists{/gist_id}","starred_url":"https://api.github.com/users/nesaulov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nesaulov/subscriptions","organizations_url":"https://api.github.com/users/nesaulov/orgs","repos_url":"https://api.github.com/users/nesaulov/repos","events_url":"https://api.github.com/users/nesaulov/events{/privacy}","received_events_url":"https://api.github.com/users/nesaulov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nesaulov/surrealist","description":"Surrealize Ruby objects according to your custom schema","fork":false,"url":"https://api.github.com/repos/nesaulov/surrealist","forks_url":"https://api.github.com/repos/nesaulov/surrealist/forks","keys_url":"https://api.github.com/repos/nesaulov/surrealist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nesaulov/surrealist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nesaulov/surrealist/teams","hooks_url":"https://api.github.com/repos/nesaulov/surrealist/hooks","issue_events_url":"https://api.github.com/repos/nesaulov/surrealist/issues/events{/number}","events_url":"https://api.github.com/repos/nesaulov/surrealist/events","assignees_url":"https://api.github.com/repos/nesaulov/surrealist/assignees{/user}","branches_url":"https://api.github.com/repos/nesaulov/surrealist/branches{/branch}","tags_url":"https://api.github.com/repos/nesaulov/surrealist/tags","blobs_url":"https://api.github.com/repos/nesaulov/surrealist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nesaulov/surrealist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nesaulov/surrealist/git/refs{/sha}","trees_url":"https://api.github.com/repos/nesaulov/surrealist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nesaulov/surrealist/statuses/{sha}","languages_url":"https://api.github.com/repos/nesaulov/surrealist/languages","stargazers_url":"https://api.github.com/repos/nesaulov/surrealist/stargazers","contributors_url":"https://api.github.com/repos/nesaulov/surrealist/contributors","subscribers_url":"https://api.github.com/repos/nesaulov/surrealist/subscribers","subscription_url":"https://api.github.com/repos/nesaulov/surrealist/subscription","commits_url":"https://api.github.com/repos/nesaulov/surrealist/commits{/sha}","git_commits_url":"https://api.github.com/repos/nesaulov/surrealist/git/commits{/sha}","comments_url":"https://api.github.com/repos/nesaulov/surrealist/comments{/number}","issue_comment_url":"https://api.github.com/repos/nesaulov/surrealist/issues/comments{/number}","contents_url":"https://api.github.com/repos/nesaulov/surrealist/contents/{+path}","compare_url":"https://api.github.com/repos/nesaulov/surrealist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nesaulov/surrealist/merges","archive_url":"https://api.github.com/repos/nesaulov/surrealist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nesaulov/surrealist/downloads","issues_url":"https://api.github.com/repos/nesaulov/surrealist/issues{/number}","pulls_url":"https://api.github.com/repos/nesaulov/surrealist/pulls{/number}","milestones_url":"https://api.github.com/repos/nesaulov/surrealist/milestones{/number}","notifications_url":"https://api.github.com/repos/nesaulov/surrealist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nesaulov/surrealist/labels{/name}","releases_url":"https://api.github.com/repos/nesaulov/surrealist/releases{/id}","deployments_url":"https://api.github.com/repos/nesaulov/surrealist/deployments","created_at":"2017-09-06T21:49:54Z","updated_at":"2017-10-30T11:03:01Z","pushed_at":"2017-10-31T18:55:20Z","git_url":"git://github.com/nesaulov/surrealist.git","ssh_url":"git@github.com:nesaulov/surrealist.git","clone_url":"https://github.com/nesaulov/surrealist.git","svn_url":"https://github.com/nesaulov/surrealist","homepage":"http://www.rubydoc.info/github/nesaulov/surrealist","size":168,"stargazers_count":101,"watchers_count":101,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"forks":6,"open_issues":5,"watchers":101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/34"},"html":{"href":"https://github.com/nesaulov/surrealist/pull/34"},"issue":{"href":"https://api.github.com/repos/nesaulov/surrealist/issues/34"},"comments":{"href":"https://api.github.com/repos/nesaulov/surrealist/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nesaulov/surrealist/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/nesaulov/surrealist/statuses/e605b54c1ca5537952fae3f9b0fcebbfa4bf44ef"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"houndci-bot"}}