{"action":"created","comment":{"url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/comments/81479111","pull_request_review_id":2456447,"id":81479111,"diff_hunk":"@@ -0,0 +1,34 @@\n+# frozen_string_literal: true\n+module StoriesApi\n+  module V3\n+    module Presenters\n+      class StoryItem\n+        TOP_LEVEL_FIELDS = [:position, :type, :sub_type].freeze\n+\n+        def call(story_item)\n+          result = {}\n+\n+          TOP_LEVEL_FIELDS.each do |field|\n+            result[field] = story_item.send(field)\n+          end\n+\n+          story_item.content.each do |k, v|\n+            result[:content] ||= {}\n+            result[:content][k] = v\n+          end\n+\n+          story_item.meta.each do |k, v|\n+            result[:meta] ||= {}\n+            result[:meta][k] = v\n+          end\n+\n+          result\n+        end\n+\n+        def self.to_proc\n+          ->(story_item) { new.call(story_item) }","path":"app/services/stories_api/v3/presenters/story_item.rb","position":29,"original_position":29,"commit_id":"56e14f9bf82158db61f49301e7b115a3a3a586df","original_commit_id":"56e14f9bf82158db61f49301e7b115a3a3a586df","user":{"login":"Reinkaos","id":1848911,"avatar_url":"https://avatars.githubusercontent.com/u/1848911?v=3","gravatar_id":"","url":"https://api.github.com/users/Reinkaos","html_url":"https://github.com/Reinkaos","followers_url":"https://api.github.com/users/Reinkaos/followers","following_url":"https://api.github.com/users/Reinkaos/following{/other_user}","gists_url":"https://api.github.com/users/Reinkaos/gists{/gist_id}","starred_url":"https://api.github.com/users/Reinkaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Reinkaos/subscriptions","organizations_url":"https://api.github.com/users/Reinkaos/orgs","repos_url":"https://api.github.com/users/Reinkaos/repos","events_url":"https://api.github.com/users/Reinkaos/events{/privacy}","received_events_url":"https://api.github.com/users/Reinkaos/received_events","type":"User","site_admin":false},"body":"I like these methods.","created_at":"2016-10-02T22:03:38Z","updated_at":"2016-10-02T22:12:21Z","html_url":"https://github.com/DigitalNZ/supplejack_api/pull/25#discussion_r81479111","pull_request_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/comments/81479111"},"html":{"href":"https://github.com/DigitalNZ/supplejack_api/pull/25#discussion_r81479111"},"pull_request":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25","id":86271683,"html_url":"https://github.com/DigitalNZ/supplejack_api/pull/25","diff_url":"https://github.com/DigitalNZ/supplejack_api/pull/25.diff","patch_url":"https://github.com/DigitalNZ/supplejack_api/pull/25.patch","issue_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/25","number":25,"state":"open","locked":false,"title":"Stories API Creation","user":{"login":"UberMouse","id":693020,"avatar_url":"https://avatars.githubusercontent.com/u/693020?v=3","gravatar_id":"","url":"https://api.github.com/users/UberMouse","html_url":"https://github.com/UberMouse","followers_url":"https://api.github.com/users/UberMouse/followers","following_url":"https://api.github.com/users/UberMouse/following{/other_user}","gists_url":"https://api.github.com/users/UberMouse/gists{/gist_id}","starred_url":"https://api.github.com/users/UberMouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UberMouse/subscriptions","organizations_url":"https://api.github.com/users/UberMouse/orgs","repos_url":"https://api.github.com/users/UberMouse/repos","events_url":"https://api.github.com/users/UberMouse/events{/privacy}","received_events_url":"https://api.github.com/users/UberMouse/received_events","type":"User","site_admin":false},"body":"Acceptance Criteria\r\n=================\r\n* Stories API created that supports added records as with existing user sets, as well as new story blocks from editor.\r\n* Stories API is documented using Swagger\r\n* Stories API can return existing user sets from Stories endpoint.\r\n* Existing sets functionality is not negatively effected\r\n* An item cannot be added to a story more than once. \r\n\r\nBackground\r\n=================\r\nCreation of the Stories API for Kereru to consume. It reuses (with some extensions) the existing UserSet/SetItem data models but presents a different API and response representation. \r\n\r\nSwagger documentation for the API: https://swaggerhub.com/api/DigitalNZ/supplejack-stories-api/3.0.0\r\n\r\nChecklist\r\n=================\r\n\r\n- [ ] Code is understandable without Dev\r\n- [ ] Acceptance criteria, what was changed, and why it was changed (If applicable) on Pull / Merge Request\r\n- [ ] All Tests are Passing\r\n- [ ] Code Coverage goes up\r\n- [ ] All new methods have a relevant spec\r\n- [ ] Methods have a single responsibility (Where applicable)\r\n- [ ] Linters Pass\r\n- [ ] ‘Yard’ style comments on methods and classes (Where applicable)\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/digitalnz/supplejack_api/25)\n<!-- Reviewable:end -->\n","created_at":"2016-09-22T02:35:26Z","updated_at":"2016-10-02T22:12:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"734567b09cf10ec3a1f6239f4f4d91382afaa604","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25/commits","review_comments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25/comments","review_comment_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/25/comments","statuses_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/statuses/56e14f9bf82158db61f49301e7b115a3a3a586df","head":{"label":"DigitalNZ:tl/stories-api","ref":"tl/stories-api","sha":"56e14f9bf82158db61f49301e7b115a3a3a586df","user":{"login":"DigitalNZ","id":93386,"avatar_url":"https://avatars.githubusercontent.com/u/93386?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalNZ","html_url":"https://github.com/DigitalNZ","followers_url":"https://api.github.com/users/DigitalNZ/followers","following_url":"https://api.github.com/users/DigitalNZ/following{/other_user}","gists_url":"https://api.github.com/users/DigitalNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalNZ/subscriptions","organizations_url":"https://api.github.com/users/DigitalNZ/orgs","repos_url":"https://api.github.com/users/DigitalNZ/repos","events_url":"https://api.github.com/users/DigitalNZ/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalNZ/received_events","type":"Organization","site_admin":false},"repo":{"id":18785204,"name":"supplejack_api","full_name":"DigitalNZ/supplejack_api","owner":{"login":"DigitalNZ","id":93386,"avatar_url":"https://avatars.githubusercontent.com/u/93386?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalNZ","html_url":"https://github.com/DigitalNZ","followers_url":"https://api.github.com/users/DigitalNZ/followers","following_url":"https://api.github.com/users/DigitalNZ/following{/other_user}","gists_url":"https://api.github.com/users/DigitalNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalNZ/subscriptions","organizations_url":"https://api.github.com/users/DigitalNZ/orgs","repos_url":"https://api.github.com/users/DigitalNZ/repos","events_url":"https://api.github.com/users/DigitalNZ/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalNZ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalNZ/supplejack_api","description":"Supplejack API Mountable Engine","fork":false,"url":"https://api.github.com/repos/DigitalNZ/supplejack_api","forks_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/forks","keys_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/teams","hooks_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/hooks","issue_events_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/events","assignees_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/tags","blobs_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/languages","stargazers_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/stargazers","contributors_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/contributors","subscribers_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/subscribers","subscription_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/subscription","commits_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/merges","archive_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/downloads","issues_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/labels{/name}","releases_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/deployments","created_at":"2014-04-15T02:49:45Z","updated_at":"2016-08-25T00:49:24Z","pushed_at":"2016-10-02T21:53:37Z","git_url":"git://github.com/DigitalNZ/supplejack_api.git","ssh_url":"git@github.com:DigitalNZ/supplejack_api.git","clone_url":"https://github.com/DigitalNZ/supplejack_api.git","svn_url":"https://github.com/DigitalNZ/supplejack_api","homepage":null,"size":2804,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"DigitalNZ:master","ref":"master","sha":"c0e06b200b42564e9af7a65fc91e4c6bd5c644e6","user":{"login":"DigitalNZ","id":93386,"avatar_url":"https://avatars.githubusercontent.com/u/93386?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalNZ","html_url":"https://github.com/DigitalNZ","followers_url":"https://api.github.com/users/DigitalNZ/followers","following_url":"https://api.github.com/users/DigitalNZ/following{/other_user}","gists_url":"https://api.github.com/users/DigitalNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalNZ/subscriptions","organizations_url":"https://api.github.com/users/DigitalNZ/orgs","repos_url":"https://api.github.com/users/DigitalNZ/repos","events_url":"https://api.github.com/users/DigitalNZ/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalNZ/received_events","type":"Organization","site_admin":false},"repo":{"id":18785204,"name":"supplejack_api","full_name":"DigitalNZ/supplejack_api","owner":{"login":"DigitalNZ","id":93386,"avatar_url":"https://avatars.githubusercontent.com/u/93386?v=3","gravatar_id":"","url":"https://api.github.com/users/DigitalNZ","html_url":"https://github.com/DigitalNZ","followers_url":"https://api.github.com/users/DigitalNZ/followers","following_url":"https://api.github.com/users/DigitalNZ/following{/other_user}","gists_url":"https://api.github.com/users/DigitalNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/DigitalNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DigitalNZ/subscriptions","organizations_url":"https://api.github.com/users/DigitalNZ/orgs","repos_url":"https://api.github.com/users/DigitalNZ/repos","events_url":"https://api.github.com/users/DigitalNZ/events{/privacy}","received_events_url":"https://api.github.com/users/DigitalNZ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DigitalNZ/supplejack_api","description":"Supplejack API Mountable Engine","fork":false,"url":"https://api.github.com/repos/DigitalNZ/supplejack_api","forks_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/forks","keys_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/teams","hooks_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/hooks","issue_events_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/events{/number}","events_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/events","assignees_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/assignees{/user}","branches_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/branches{/branch}","tags_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/tags","blobs_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/statuses/{sha}","languages_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/languages","stargazers_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/stargazers","contributors_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/contributors","subscribers_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/subscribers","subscription_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/subscription","commits_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/contents/{+path}","compare_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/merges","archive_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/downloads","issues_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues{/number}","pulls_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls{/number}","milestones_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/milestones{/number}","notifications_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/labels{/name}","releases_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/releases{/id}","deployments_url":"https://api.github.com/repos/DigitalNZ/supplejack_api/deployments","created_at":"2014-04-15T02:49:45Z","updated_at":"2016-08-25T00:49:24Z","pushed_at":"2016-10-02T21:53:37Z","git_url":"git://github.com/DigitalNZ/supplejack_api.git","ssh_url":"git@github.com:DigitalNZ/supplejack_api.git","clone_url":"https://github.com/DigitalNZ/supplejack_api.git","svn_url":"https://github.com/DigitalNZ/supplejack_api","homepage":null,"size":2804,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25"},"html":{"href":"https://github.com/DigitalNZ/supplejack_api/pull/25"},"issue":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/25"},"comments":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/DigitalNZ/supplejack_api/statuses/56e14f9bf82158db61f49301e7b115a3a3a586df"}}}}
{"actor":{"display_login":"Reinkaos"}}