{"action":"created","comment":{"url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/comments/192880524","pull_request_review_id":125741837,"id":192880524,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mjg4MDUyNA==","diff_hunk":"@@ -0,0 +1,46 @@\n+require 'yaml'\n+require_relative './utils.rb'\n+require_relative './book.rb'\n+require_relative './author.rb'\n+require_relative './reader.rb'\n+require_relative './order.rb'\n+# Class describes Library entity\n+class Library\n+  attr_reader :utils, :library_data\n+\n+  def initialize(datafile)\n+    @utils = Utils.new(datafile)\n+    @library_data = @utils.load_file\n+  end\n+\n+  def get_results(model_name, search_criteria, num_of_records)\n+    @library_data[:orders].group_by { |order| order.send(model_name).send(search_criteria) }\n+                          .max_by(num_of_records) { |_criteria, encountered_times| encountered_times.length}\n+  end\n+\n+  def most_popular_book\n+    get_results('book', 'title', 1).first.first\n+  end\n+\n+  def most_active_reader\n+    get_results('reader', 'name', 1).first.first\n+  end\n+\n+  def three_popular_books_ordered_times\n+    book_ordered_times = 0","path":"lib/library.rb","position":30,"original_position":30,"commit_id":"20111bf1041a6275e67bd3a20785ff211276826c","original_commit_id":"20111bf1041a6275e67bd3a20785ff211276826c","user":{"login":"Svatok","id":18479771,"node_id":"MDQ6VXNlcjE4NDc5Nzcx","avatar_url":"https://avatars0.githubusercontent.com/u/18479771?v=4","gravatar_id":"","url":"https://api.github.com/users/Svatok","html_url":"https://github.com/Svatok","followers_url":"https://api.github.com/users/Svatok/followers","following_url":"https://api.github.com/users/Svatok/following{/other_user}","gists_url":"https://api.github.com/users/Svatok/gists{/gist_id}","starred_url":"https://api.github.com/users/Svatok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Svatok/subscriptions","organizations_url":"https://api.github.com/users/Svatok/orgs","repos_url":"https://api.github.com/users/Svatok/repos","events_url":"https://api.github.com/users/Svatok/events{/privacy}","received_events_url":"https://api.github.com/users/Svatok/received_events","type":"User","site_admin":false},"body":"```ruby\r\n    popular_books = get_results('book', 3)\r\n    @library_data[:orders].select { |order| popular_books.include?(order.book) }.count\r\n```","created_at":"2018-06-04T21:06:19Z","updated_at":"2018-06-04T21:10:33Z","html_url":"https://github.com/ytokisd/lib_rg/pull/1#discussion_r192880524","pull_request_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/comments/192880524"},"html":{"href":"https://github.com/ytokisd/lib_rg/pull/1#discussion_r192880524"},"pull_request":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1","id":187682062,"node_id":"MDExOlB1bGxSZXF1ZXN0MTg3NjgyMDYy","html_url":"https://github.com/ytokisd/lib_rg/pull/1","diff_url":"https://github.com/ytokisd/lib_rg/pull/1.diff","patch_url":"https://github.com/ytokisd/lib_rg/pull/1.patch","issue_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/1","number":1,"state":"open","locked":false,"title":"review commit","user":{"login":"ytokisd","id":27485274,"node_id":"MDQ6VXNlcjI3NDg1Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/27485274?v=4","gravatar_id":"","url":"https://api.github.com/users/ytokisd","html_url":"https://github.com/ytokisd","followers_url":"https://api.github.com/users/ytokisd/followers","following_url":"https://api.github.com/users/ytokisd/following{/other_user}","gists_url":"https://api.github.com/users/ytokisd/gists{/gist_id}","starred_url":"https://api.github.com/users/ytokisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ytokisd/subscriptions","organizations_url":"https://api.github.com/users/ytokisd/orgs","repos_url":"https://api.github.com/users/ytokisd/repos","events_url":"https://api.github.com/users/ytokisd/events{/privacy}","received_events_url":"https://api.github.com/users/ytokisd/received_events","type":"User","site_admin":false},"body":"Library homework for RG","created_at":"2018-05-13T17:50:55Z","updated_at":"2018-06-04T21:10:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"496ff30e0d35c0e316fe05bff7c845fda8792788","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/1/comments","statuses_url":"https://api.github.com/repos/ytokisd/lib_rg/statuses/20111bf1041a6275e67bd3a20785ff211276826c","head":{"label":"ytokisd:for-review","ref":"for-review","sha":"20111bf1041a6275e67bd3a20785ff211276826c","user":{"login":"ytokisd","id":27485274,"node_id":"MDQ6VXNlcjI3NDg1Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/27485274?v=4","gravatar_id":"","url":"https://api.github.com/users/ytokisd","html_url":"https://github.com/ytokisd","followers_url":"https://api.github.com/users/ytokisd/followers","following_url":"https://api.github.com/users/ytokisd/following{/other_user}","gists_url":"https://api.github.com/users/ytokisd/gists{/gist_id}","starred_url":"https://api.github.com/users/ytokisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ytokisd/subscriptions","organizations_url":"https://api.github.com/users/ytokisd/orgs","repos_url":"https://api.github.com/users/ytokisd/repos","events_url":"https://api.github.com/users/ytokisd/events{/privacy}","received_events_url":"https://api.github.com/users/ytokisd/received_events","type":"User","site_admin":false},"repo":{"id":133260633,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMyNjA2MzM=","name":"lib_rg","full_name":"ytokisd/lib_rg","owner":{"login":"ytokisd","id":27485274,"node_id":"MDQ6VXNlcjI3NDg1Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/27485274?v=4","gravatar_id":"","url":"https://api.github.com/users/ytokisd","html_url":"https://github.com/ytokisd","followers_url":"https://api.github.com/users/ytokisd/followers","following_url":"https://api.github.com/users/ytokisd/following{/other_user}","gists_url":"https://api.github.com/users/ytokisd/gists{/gist_id}","starred_url":"https://api.github.com/users/ytokisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ytokisd/subscriptions","organizations_url":"https://api.github.com/users/ytokisd/orgs","repos_url":"https://api.github.com/users/ytokisd/repos","events_url":"https://api.github.com/users/ytokisd/events{/privacy}","received_events_url":"https://api.github.com/users/ytokisd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ytokisd/lib_rg","description":"library homework for RG","fork":false,"url":"https://api.github.com/repos/ytokisd/lib_rg","forks_url":"https://api.github.com/repos/ytokisd/lib_rg/forks","keys_url":"https://api.github.com/repos/ytokisd/lib_rg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ytokisd/lib_rg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ytokisd/lib_rg/teams","hooks_url":"https://api.github.com/repos/ytokisd/lib_rg/hooks","issue_events_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/events{/number}","events_url":"https://api.github.com/repos/ytokisd/lib_rg/events","assignees_url":"https://api.github.com/repos/ytokisd/lib_rg/assignees{/user}","branches_url":"https://api.github.com/repos/ytokisd/lib_rg/branches{/branch}","tags_url":"https://api.github.com/repos/ytokisd/lib_rg/tags","blobs_url":"https://api.github.com/repos/ytokisd/lib_rg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ytokisd/lib_rg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ytokisd/lib_rg/git/refs{/sha}","trees_url":"https://api.github.com/repos/ytokisd/lib_rg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ytokisd/lib_rg/statuses/{sha}","languages_url":"https://api.github.com/repos/ytokisd/lib_rg/languages","stargazers_url":"https://api.github.com/repos/ytokisd/lib_rg/stargazers","contributors_url":"https://api.github.com/repos/ytokisd/lib_rg/contributors","subscribers_url":"https://api.github.com/repos/ytokisd/lib_rg/subscribers","subscription_url":"https://api.github.com/repos/ytokisd/lib_rg/subscription","commits_url":"https://api.github.com/repos/ytokisd/lib_rg/commits{/sha}","git_commits_url":"https://api.github.com/repos/ytokisd/lib_rg/git/commits{/sha}","comments_url":"https://api.github.com/repos/ytokisd/lib_rg/comments{/number}","issue_comment_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/comments{/number}","contents_url":"https://api.github.com/repos/ytokisd/lib_rg/contents/{+path}","compare_url":"https://api.github.com/repos/ytokisd/lib_rg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ytokisd/lib_rg/merges","archive_url":"https://api.github.com/repos/ytokisd/lib_rg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ytokisd/lib_rg/downloads","issues_url":"https://api.github.com/repos/ytokisd/lib_rg/issues{/number}","pulls_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls{/number}","milestones_url":"https://api.github.com/repos/ytokisd/lib_rg/milestones{/number}","notifications_url":"https://api.github.com/repos/ytokisd/lib_rg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ytokisd/lib_rg/labels{/name}","releases_url":"https://api.github.com/repos/ytokisd/lib_rg/releases{/id}","deployments_url":"https://api.github.com/repos/ytokisd/lib_rg/deployments","created_at":"2018-05-13T17:45:52Z","updated_at":"2018-05-13T17:45:55Z","pushed_at":"2018-06-03T06:50:34Z","git_url":"git://github.com/ytokisd/lib_rg.git","ssh_url":"git@github.com:ytokisd/lib_rg.git","clone_url":"https://github.com/ytokisd/lib_rg.git","svn_url":"https://github.com/ytokisd/lib_rg","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ytokisd:master","ref":"master","sha":"b39c02a5e9f770891a92b35f52fb342c13e6734d","user":{"login":"ytokisd","id":27485274,"node_id":"MDQ6VXNlcjI3NDg1Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/27485274?v=4","gravatar_id":"","url":"https://api.github.com/users/ytokisd","html_url":"https://github.com/ytokisd","followers_url":"https://api.github.com/users/ytokisd/followers","following_url":"https://api.github.com/users/ytokisd/following{/other_user}","gists_url":"https://api.github.com/users/ytokisd/gists{/gist_id}","starred_url":"https://api.github.com/users/ytokisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ytokisd/subscriptions","organizations_url":"https://api.github.com/users/ytokisd/orgs","repos_url":"https://api.github.com/users/ytokisd/repos","events_url":"https://api.github.com/users/ytokisd/events{/privacy}","received_events_url":"https://api.github.com/users/ytokisd/received_events","type":"User","site_admin":false},"repo":{"id":133260633,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMyNjA2MzM=","name":"lib_rg","full_name":"ytokisd/lib_rg","owner":{"login":"ytokisd","id":27485274,"node_id":"MDQ6VXNlcjI3NDg1Mjc0","avatar_url":"https://avatars3.githubusercontent.com/u/27485274?v=4","gravatar_id":"","url":"https://api.github.com/users/ytokisd","html_url":"https://github.com/ytokisd","followers_url":"https://api.github.com/users/ytokisd/followers","following_url":"https://api.github.com/users/ytokisd/following{/other_user}","gists_url":"https://api.github.com/users/ytokisd/gists{/gist_id}","starred_url":"https://api.github.com/users/ytokisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ytokisd/subscriptions","organizations_url":"https://api.github.com/users/ytokisd/orgs","repos_url":"https://api.github.com/users/ytokisd/repos","events_url":"https://api.github.com/users/ytokisd/events{/privacy}","received_events_url":"https://api.github.com/users/ytokisd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ytokisd/lib_rg","description":"library homework for RG","fork":false,"url":"https://api.github.com/repos/ytokisd/lib_rg","forks_url":"https://api.github.com/repos/ytokisd/lib_rg/forks","keys_url":"https://api.github.com/repos/ytokisd/lib_rg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ytokisd/lib_rg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ytokisd/lib_rg/teams","hooks_url":"https://api.github.com/repos/ytokisd/lib_rg/hooks","issue_events_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/events{/number}","events_url":"https://api.github.com/repos/ytokisd/lib_rg/events","assignees_url":"https://api.github.com/repos/ytokisd/lib_rg/assignees{/user}","branches_url":"https://api.github.com/repos/ytokisd/lib_rg/branches{/branch}","tags_url":"https://api.github.com/repos/ytokisd/lib_rg/tags","blobs_url":"https://api.github.com/repos/ytokisd/lib_rg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ytokisd/lib_rg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ytokisd/lib_rg/git/refs{/sha}","trees_url":"https://api.github.com/repos/ytokisd/lib_rg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ytokisd/lib_rg/statuses/{sha}","languages_url":"https://api.github.com/repos/ytokisd/lib_rg/languages","stargazers_url":"https://api.github.com/repos/ytokisd/lib_rg/stargazers","contributors_url":"https://api.github.com/repos/ytokisd/lib_rg/contributors","subscribers_url":"https://api.github.com/repos/ytokisd/lib_rg/subscribers","subscription_url":"https://api.github.com/repos/ytokisd/lib_rg/subscription","commits_url":"https://api.github.com/repos/ytokisd/lib_rg/commits{/sha}","git_commits_url":"https://api.github.com/repos/ytokisd/lib_rg/git/commits{/sha}","comments_url":"https://api.github.com/repos/ytokisd/lib_rg/comments{/number}","issue_comment_url":"https://api.github.com/repos/ytokisd/lib_rg/issues/comments{/number}","contents_url":"https://api.github.com/repos/ytokisd/lib_rg/contents/{+path}","compare_url":"https://api.github.com/repos/ytokisd/lib_rg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ytokisd/lib_rg/merges","archive_url":"https://api.github.com/repos/ytokisd/lib_rg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ytokisd/lib_rg/downloads","issues_url":"https://api.github.com/repos/ytokisd/lib_rg/issues{/number}","pulls_url":"https://api.github.com/repos/ytokisd/lib_rg/pulls{/number}","milestones_url":"https://api.github.com/repos/ytokisd/lib_rg/milestones{/number}","notifications_url":"https://api.github.com/repos/ytokisd/lib_rg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ytokisd/lib_rg/labels{/name}","releases_url":"https://api.github.com/repos/ytokisd/lib_rg/releases{/id}","deployments_url":"https://api.github.com/repos/ytokisd/lib_rg/deployments","created_at":"2018-05-13T17:45:52Z","updated_at":"2018-05-13T17:45:55Z","pushed_at":"2018-06-03T06:50:34Z","git_url":"git://github.com/ytokisd/lib_rg.git","ssh_url":"git@github.com:ytokisd/lib_rg.git","clone_url":"https://github.com/ytokisd/lib_rg.git","svn_url":"https://github.com/ytokisd/lib_rg","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1"},"html":{"href":"https://github.com/ytokisd/lib_rg/pull/1"},"issue":{"href":"https://api.github.com/repos/ytokisd/lib_rg/issues/1"},"comments":{"href":"https://api.github.com/repos/ytokisd/lib_rg/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ytokisd/lib_rg/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ytokisd/lib_rg/statuses/20111bf1041a6275e67bd3a20785ff211276826c"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Svatok"}}