{"action":"created","comment":{"url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/comments/93374744","pull_request_review_id":13899965,"id":93374744,"diff_hunk":"@@ -0,0 +1,178 @@\n+class MyAnimeListSyncService\n+  ATARASHII_API_HOST = 'https://hbv3-mal-api.herokuapp.com/2.1/'.freeze\n+  MINE = '?mine=1'.freeze\n+\n+  attr_reader :le, :method\n+\n+  def initialize(le, method)\n+    @le = le\n+    @method = method\n+  end\n+\n+  def execute_method\n+    # anime or manga\n+    media_type = le.media_type.underscore\n+    # convert kitsu data -> mal data\n+    mal_media = le.media.mappings.find_by(site: \"myanimelist/#{media_type}\")\n+    # user mal profile information\n+    profile = LinkedProfile.find_by(\n+      user_id: le.user_id,\n+      url: 'myanimelist'\n+    )\n+    mal_media_id = mal_media.external_id\n+\n+    case method\n+    when 'delete'\n+      delete(\n+        \"#{animelist}/#{mal_media_type}/#{mal_media_id}\",\n+        profile\n+      )\n+    else\n+      # find the anime or manga\n+      get(\"#{media_type}/#{mal_media_id}#{MINE}\", profile) do |response|\n+        # check if watched status exists\n+        if response['watched_status']\n+          # update\n+          # TODO: retry later on if we need to\n+          put(\n+            \"animelist/#{media_type}/#{mal_media_id}\",\n+            profile,\n+            {\n+              status: format_status(le.status),\n+              episodes: le.progress,\n+              score: format_score(le.rating),\n+              rewatch_count: le.reconsume_count\n+            }\n+          )\n+        else\n+          # create\n+          # TODO: retry later on if we need to\n+          post(\n+            \"animelist/#{media_type}\",\n+            profile,\n+            {","path":"app/services/my_anime_list_sync_service.rb","position":53,"original_position":53,"commit_id":"979bb622e0b75fe3eef6a80318381f82eb0735c3","original_commit_id":"979bb622e0b75fe3eef6a80318381f82eb0735c3","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","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":"Redundant curly braces around a hash parameter.","created_at":"2016-12-21T04:44:31Z","updated_at":"2016-12-21T04:44:31Z","html_url":"https://github.com/hummingbird-me/hummingbird-server/pull/25#discussion_r93374744","pull_request_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/comments/93374744"},"html":{"href":"https://github.com/hummingbird-me/hummingbird-server/pull/25#discussion_r93374744"},"pull_request":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25","id":98484674,"html_url":"https://github.com/hummingbird-me/hummingbird-server/pull/25","diff_url":"https://github.com/hummingbird-me/hummingbird-server/pull/25.diff","patch_url":"https://github.com/hummingbird-me/hummingbird-server/pull/25.patch","issue_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/25","number":25,"state":"open","locked":false,"title":"Mal Auto Updates","user":{"login":"toyhammered","id":1283983,"avatar_url":"https://avatars.githubusercontent.com/u/1283983?v=3","gravatar_id":"","url":"https://api.github.com/users/toyhammered","html_url":"https://github.com/toyhammered","followers_url":"https://api.github.com/users/toyhammered/followers","following_url":"https://api.github.com/users/toyhammered/following{/other_user}","gists_url":"https://api.github.com/users/toyhammered/gists{/gist_id}","starred_url":"https://api.github.com/users/toyhammered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toyhammered/subscriptions","organizations_url":"https://api.github.com/users/toyhammered/orgs","repos_url":"https://api.github.com/users/toyhammered/repos","events_url":"https://api.github.com/users/toyhammered/events{/privacy}","received_events_url":"https://api.github.com/users/toyhammered/received_events","type":"User","site_admin":false},"body":"**Feature:** Kitsu will update your mal list so it is in sync with Kitsu at all times\r\n\r\n~~**[x]** - when a user updates a library entry it will update mal list also~~\r\n**[WIP]** - when a user initially syncs their account (inputting username/password) we will completely sync    up their mal list to be the same as kitsu list\r\n  ~~- [x] will create/update all entries~~\r\n    - [] will delete any entries on mal list and not on kitsu list\r\n**[WIP]** - write behavior tests for `get, delete, post` methods\r\n**[WIP]** - make sure this works with anime and manga\r\n  ~~- **[x]** anime~~\r\n    - **[WIP]** manga\r\n","created_at":"2016-12-18T19:37:25Z","updated_at":"2016-12-21T04:44:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"495e8b09889f6e74e16b13b8a862e2f59a506784","assignee":{"login":"toyhammered","id":1283983,"avatar_url":"https://avatars.githubusercontent.com/u/1283983?v=3","gravatar_id":"","url":"https://api.github.com/users/toyhammered","html_url":"https://github.com/toyhammered","followers_url":"https://api.github.com/users/toyhammered/followers","following_url":"https://api.github.com/users/toyhammered/following{/other_user}","gists_url":"https://api.github.com/users/toyhammered/gists{/gist_id}","starred_url":"https://api.github.com/users/toyhammered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toyhammered/subscriptions","organizations_url":"https://api.github.com/users/toyhammered/orgs","repos_url":"https://api.github.com/users/toyhammered/repos","events_url":"https://api.github.com/users/toyhammered/events{/privacy}","received_events_url":"https://api.github.com/users/toyhammered/received_events","type":"User","site_admin":false},"assignees":[{"login":"toyhammered","id":1283983,"avatar_url":"https://avatars.githubusercontent.com/u/1283983?v=3","gravatar_id":"","url":"https://api.github.com/users/toyhammered","html_url":"https://github.com/toyhammered","followers_url":"https://api.github.com/users/toyhammered/followers","following_url":"https://api.github.com/users/toyhammered/following{/other_user}","gists_url":"https://api.github.com/users/toyhammered/gists{/gist_id}","starred_url":"https://api.github.com/users/toyhammered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toyhammered/subscriptions","organizations_url":"https://api.github.com/users/toyhammered/orgs","repos_url":"https://api.github.com/users/toyhammered/repos","events_url":"https://api.github.com/users/toyhammered/events{/privacy}","received_events_url":"https://api.github.com/users/toyhammered/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25/commits","review_comments_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25/comments","review_comment_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/25/comments","statuses_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/statuses/979bb622e0b75fe3eef6a80318381f82eb0735c3","head":{"label":"toyhammered:mal-auto-updates","ref":"mal-auto-updates","sha":"979bb622e0b75fe3eef6a80318381f82eb0735c3","user":{"login":"toyhammered","id":1283983,"avatar_url":"https://avatars.githubusercontent.com/u/1283983?v=3","gravatar_id":"","url":"https://api.github.com/users/toyhammered","html_url":"https://github.com/toyhammered","followers_url":"https://api.github.com/users/toyhammered/followers","following_url":"https://api.github.com/users/toyhammered/following{/other_user}","gists_url":"https://api.github.com/users/toyhammered/gists{/gist_id}","starred_url":"https://api.github.com/users/toyhammered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toyhammered/subscriptions","organizations_url":"https://api.github.com/users/toyhammered/orgs","repos_url":"https://api.github.com/users/toyhammered/repos","events_url":"https://api.github.com/users/toyhammered/events{/privacy}","received_events_url":"https://api.github.com/users/toyhammered/received_events","type":"User","site_admin":false},"repo":{"id":70123540,"name":"hummingbird-server","full_name":"toyhammered/hummingbird-server","owner":{"login":"toyhammered","id":1283983,"avatar_url":"https://avatars.githubusercontent.com/u/1283983?v=3","gravatar_id":"","url":"https://api.github.com/users/toyhammered","html_url":"https://github.com/toyhammered","followers_url":"https://api.github.com/users/toyhammered/followers","following_url":"https://api.github.com/users/toyhammered/following{/other_user}","gists_url":"https://api.github.com/users/toyhammered/gists{/gist_id}","starred_url":"https://api.github.com/users/toyhammered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toyhammered/subscriptions","organizations_url":"https://api.github.com/users/toyhammered/orgs","repos_url":"https://api.github.com/users/toyhammered/repos","events_url":"https://api.github.com/users/toyhammered/events{/privacy}","received_events_url":"https://api.github.com/users/toyhammered/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/toyhammered/hummingbird-server","description":"Rails API server for Hummingbird.me","fork":true,"url":"https://api.github.com/repos/toyhammered/hummingbird-server","forks_url":"https://api.github.com/repos/toyhammered/hummingbird-server/forks","keys_url":"https://api.github.com/repos/toyhammered/hummingbird-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toyhammered/hummingbird-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toyhammered/hummingbird-server/teams","hooks_url":"https://api.github.com/repos/toyhammered/hummingbird-server/hooks","issue_events_url":"https://api.github.com/repos/toyhammered/hummingbird-server/issues/events{/number}","events_url":"https://api.github.com/repos/toyhammered/hummingbird-server/events","assignees_url":"https://api.github.com/repos/toyhammered/hummingbird-server/assignees{/user}","branches_url":"https://api.github.com/repos/toyhammered/hummingbird-server/branches{/branch}","tags_url":"https://api.github.com/repos/toyhammered/hummingbird-server/tags","blobs_url":"https://api.github.com/repos/toyhammered/hummingbird-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toyhammered/hummingbird-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toyhammered/hummingbird-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/toyhammered/hummingbird-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toyhammered/hummingbird-server/statuses/{sha}","languages_url":"https://api.github.com/repos/toyhammered/hummingbird-server/languages","stargazers_url":"https://api.github.com/repos/toyhammered/hummingbird-server/stargazers","contributors_url":"https://api.github.com/repos/toyhammered/hummingbird-server/contributors","subscribers_url":"https://api.github.com/repos/toyhammered/hummingbird-server/subscribers","subscription_url":"https://api.github.com/repos/toyhammered/hummingbird-server/subscription","commits_url":"https://api.github.com/repos/toyhammered/hummingbird-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/toyhammered/hummingbird-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/toyhammered/hummingbird-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/toyhammered/hummingbird-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/toyhammered/hummingbird-server/contents/{+path}","compare_url":"https://api.github.com/repos/toyhammered/hummingbird-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toyhammered/hummingbird-server/merges","archive_url":"https://api.github.com/repos/toyhammered/hummingbird-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toyhammered/hummingbird-server/downloads","issues_url":"https://api.github.com/repos/toyhammered/hummingbird-server/issues{/number}","pulls_url":"https://api.github.com/repos/toyhammered/hummingbird-server/pulls{/number}","milestones_url":"https://api.github.com/repos/toyhammered/hummingbird-server/milestones{/number}","notifications_url":"https://api.github.com/repos/toyhammered/hummingbird-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toyhammered/hummingbird-server/labels{/name}","releases_url":"https://api.github.com/repos/toyhammered/hummingbird-server/releases{/id}","deployments_url":"https://api.github.com/repos/toyhammered/hummingbird-server/deployments","created_at":"2016-10-06T04:46:43Z","updated_at":"2016-10-06T04:46:44Z","pushed_at":"2016-12-21T04:44:20Z","git_url":"git://github.com/toyhammered/hummingbird-server.git","ssh_url":"git@github.com:toyhammered/hummingbird-server.git","clone_url":"https://github.com/toyhammered/hummingbird-server.git","svn_url":"https://github.com/toyhammered/hummingbird-server","homepage":null,"size":1665,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"the-future"}},"base":{"label":"hummingbird-me:the-future","ref":"the-future","sha":"ab9ed3ec83e16c4e2fdec9d61d7822ccafa8ed9e","user":{"login":"hummingbird-me","id":7648832,"avatar_url":"https://avatars.githubusercontent.com/u/7648832?v=3","gravatar_id":"","url":"https://api.github.com/users/hummingbird-me","html_url":"https://github.com/hummingbird-me","followers_url":"https://api.github.com/users/hummingbird-me/followers","following_url":"https://api.github.com/users/hummingbird-me/following{/other_user}","gists_url":"https://api.github.com/users/hummingbird-me/gists{/gist_id}","starred_url":"https://api.github.com/users/hummingbird-me/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hummingbird-me/subscriptions","organizations_url":"https://api.github.com/users/hummingbird-me/orgs","repos_url":"https://api.github.com/users/hummingbird-me/repos","events_url":"https://api.github.com/users/hummingbird-me/events{/privacy}","received_events_url":"https://api.github.com/users/hummingbird-me/received_events","type":"Organization","site_admin":false},"repo":{"id":68339720,"name":"hummingbird-server","full_name":"hummingbird-me/hummingbird-server","owner":{"login":"hummingbird-me","id":7648832,"avatar_url":"https://avatars.githubusercontent.com/u/7648832?v=3","gravatar_id":"","url":"https://api.github.com/users/hummingbird-me","html_url":"https://github.com/hummingbird-me","followers_url":"https://api.github.com/users/hummingbird-me/followers","following_url":"https://api.github.com/users/hummingbird-me/following{/other_user}","gists_url":"https://api.github.com/users/hummingbird-me/gists{/gist_id}","starred_url":"https://api.github.com/users/hummingbird-me/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hummingbird-me/subscriptions","organizations_url":"https://api.github.com/users/hummingbird-me/orgs","repos_url":"https://api.github.com/users/hummingbird-me/repos","events_url":"https://api.github.com/users/hummingbird-me/events{/privacy}","received_events_url":"https://api.github.com/users/hummingbird-me/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hummingbird-me/hummingbird-server","description":":steam_locomotive: Rails API server for Hummingbird.me","fork":false,"url":"https://api.github.com/repos/hummingbird-me/hummingbird-server","forks_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/forks","keys_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/teams","hooks_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/hooks","issue_events_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/events{/number}","events_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/events","assignees_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/assignees{/user}","branches_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/branches{/branch}","tags_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/tags","blobs_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/statuses/{sha}","languages_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/languages","stargazers_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/stargazers","contributors_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/contributors","subscribers_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/subscribers","subscription_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/subscription","commits_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/contents/{+path}","compare_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/merges","archive_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/downloads","issues_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues{/number}","pulls_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls{/number}","milestones_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/milestones{/number}","notifications_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/labels{/name}","releases_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/releases{/id}","deployments_url":"https://api.github.com/repos/hummingbird-me/hummingbird-server/deployments","created_at":"2016-09-15T23:36:19Z","updated_at":"2016-12-19T17:57:19Z","pushed_at":"2016-12-21T04:44:21Z","git_url":"git://github.com/hummingbird-me/hummingbird-server.git","ssh_url":"git@github.com:hummingbird-me/hummingbird-server.git","clone_url":"https://github.com/hummingbird-me/hummingbird-server.git","svn_url":"https://github.com/hummingbird-me/hummingbird-server","homepage":"","size":1686,"stargazers_count":19,"watchers_count":19,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":5,"forks":29,"open_issues":5,"watchers":19,"default_branch":"the-future"}},"_links":{"self":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25"},"html":{"href":"https://github.com/hummingbird-me/hummingbird-server/pull/25"},"issue":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/25"},"comments":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/hummingbird-me/hummingbird-server/statuses/979bb622e0b75fe3eef6a80318381f82eb0735c3"}}}}
{"actor":{"display_login":"houndci-bot"}}