{"action":"created","comment":{"url":"https://api.github.com/repos/2600hz/kazoo/pulls/comments/37524396","id":37524396,"diff_hunk":"@@ -868,17 +868,24 @@ ensure_content_type(CT) -> CT.\n %% (the final module in the chain) accepts this verb parameter pair.\n %% @end\n %%--------------------------------------------------------------------\n--spec does_resource_exist(cb_context:context()) -> boolean().\n--spec does_resource_exist(cb_context:context(), list()) -> boolean().\n+-spec does_resource_exist(cb_context:context()) -> {boolean(), cb_context:context()}.\n+-spec does_resource_exist(cb_context:context(), list()) -> {boolean(), cb_context:context()}.\n does_resource_exist(Context) ->\n     does_resource_exist(Context, cb_context:req_nouns(Context)).\n \n does_resource_exist(Context, [{Mod, Params}|_]) ->\n     Event = api_util:create_event_name(Context, <<\"resource_exists.\", Mod/binary>>),\n-    Responses = crossbar_bindings:map(Event, Params),\n-    crossbar_bindings:any(Responses) and 'true';\n-does_resource_exist(_Context, _ReqNouns) ->\n-    'false'.\n+    Responses = crossbar_bindings:map(Event, [Context, Params]),","path":"applications/crossbar/src/api_util.erl","position":17,"original_position":17,"commit_id":"bbd6eed8a497db97a6374d4e9710f7304c469daf","original_commit_id":"bbd6eed8a497db97a6374d4e9710f7304c469daf","user":{"login":"siplabs","id":1489408,"avatar_url":"https://avatars.githubusercontent.com/u/1489408?v=3","gravatar_id":"","url":"https://api.github.com/users/siplabs","html_url":"https://github.com/siplabs","followers_url":"https://api.github.com/users/siplabs/followers","following_url":"https://api.github.com/users/siplabs/following{/other_user}","gists_url":"https://api.github.com/users/siplabs/gists{/gist_id}","starred_url":"https://api.github.com/users/siplabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siplabs/subscriptions","organizations_url":"https://api.github.com/users/siplabs/orgs","repos_url":"https://api.github.com/users/siplabs/repos","events_url":"https://api.github.com/users/siplabs/events{/privacy}","received_events_url":"https://api.github.com/users/siplabs/received_events","type":"User","site_admin":false},"body":"@jamesaimonetti \r\nSorry, haven't enough time to answer.\r\n\r\nI called `crossbar_bindings:map` in this way to have only one function with arity 2.\r\nIt prevents spagetti of specs.\r\nDeveloper can add clause to match \"generic\" situation.\r\nDeveloper still can pattern match all needed variables.\r\nIn my opinion `resource_exists` should check if resource realy exists, and can skip checks for actions. Actions may be checked in `allowed_methods`.\r\nGetting `/v../accounts/.../<resource_type>/<resource_id>` and `/v../accounts/.../<resource_type>/<resource_id>/<action>` will check the same resource. Do we realy need several function for this?","created_at":"2015-08-20T12:46:31Z","updated_at":"2015-08-20T12:46:31Z","html_url":"https://github.com/2600hz/kazoo/pull/1157#discussion_r37524396","pull_request_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1157","_links":{"self":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/comments/37524396"},"html":{"href":"https://github.com/2600hz/kazoo/pull/1157#discussion_r37524396"},"pull_request":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1157"}}},"pull_request":{"url":"https://api.github.com/repos/2600hz/kazoo/pulls/1157","id":40207954,"html_url":"https://github.com/2600hz/kazoo/pull/1157","diff_url":"https://github.com/2600hz/kazoo/pull/1157.diff","patch_url":"https://github.com/2600hz/kazoo/pull/1157.patch","issue_url":"https://api.github.com/repos/2600hz/kazoo/issues/1157","number":1157,"state":"open","locked":false,"title":"KAZOO-3976: updated `resource_exists` callback","user":{"login":"siplabs","id":1489408,"avatar_url":"https://avatars.githubusercontent.com/u/1489408?v=3","gravatar_id":"","url":"https://api.github.com/users/siplabs","html_url":"https://github.com/siplabs","followers_url":"https://api.github.com/users/siplabs/followers","following_url":"https://api.github.com/users/siplabs/following{/other_user}","gists_url":"https://api.github.com/users/siplabs/gists{/gist_id}","starred_url":"https://api.github.com/users/siplabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siplabs/subscriptions","organizations_url":"https://api.github.com/users/siplabs/orgs","repos_url":"https://api.github.com/users/siplabs/repos","events_url":"https://api.github.com/users/siplabs/events{/privacy}","received_events_url":"https://api.github.com/users/siplabs/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-17T07:57:01Z","updated_at":"2015-08-20T12:46:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6dca6269b40ee2823f880ad4358878ca2612e892","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1157/commits","review_comments_url":"https://api.github.com/repos/2600hz/kazoo/pulls/1157/comments","review_comment_url":"https://api.github.com/repos/2600hz/kazoo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/2600hz/kazoo/issues/1157/comments","statuses_url":"https://api.github.com/repos/2600hz/kazoo/statuses/bbd6eed8a497db97a6374d4e9710f7304c469daf","head":{"label":"siplabs:KAZOO-3976","ref":"KAZOO-3976","sha":"bbd6eed8a497db97a6374d4e9710f7304c469daf","user":{"login":"siplabs","id":1489408,"avatar_url":"https://avatars.githubusercontent.com/u/1489408?v=3","gravatar_id":"","url":"https://api.github.com/users/siplabs","html_url":"https://github.com/siplabs","followers_url":"https://api.github.com/users/siplabs/followers","following_url":"https://api.github.com/users/siplabs/following{/other_user}","gists_url":"https://api.github.com/users/siplabs/gists{/gist_id}","starred_url":"https://api.github.com/users/siplabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siplabs/subscriptions","organizations_url":"https://api.github.com/users/siplabs/orgs","repos_url":"https://api.github.com/users/siplabs/repos","events_url":"https://api.github.com/users/siplabs/events{/privacy}","received_events_url":"https://api.github.com/users/siplabs/received_events","type":"User","site_admin":false},"repo":{"id":18828051,"name":"kazoo","full_name":"siplabs/kazoo","owner":{"login":"siplabs","id":1489408,"avatar_url":"https://avatars.githubusercontent.com/u/1489408?v=3","gravatar_id":"","url":"https://api.github.com/users/siplabs","html_url":"https://github.com/siplabs","followers_url":"https://api.github.com/users/siplabs/followers","following_url":"https://api.github.com/users/siplabs/following{/other_user}","gists_url":"https://api.github.com/users/siplabs/gists{/gist_id}","starred_url":"https://api.github.com/users/siplabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siplabs/subscriptions","organizations_url":"https://api.github.com/users/siplabs/orgs","repos_url":"https://api.github.com/users/siplabs/repos","events_url":"https://api.github.com/users/siplabs/events{/privacy}","received_events_url":"https://api.github.com/users/siplabs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/siplabs/kazoo","description":"","fork":true,"url":"https://api.github.com/repos/siplabs/kazoo","forks_url":"https://api.github.com/repos/siplabs/kazoo/forks","keys_url":"https://api.github.com/repos/siplabs/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/siplabs/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/siplabs/kazoo/teams","hooks_url":"https://api.github.com/repos/siplabs/kazoo/hooks","issue_events_url":"https://api.github.com/repos/siplabs/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/siplabs/kazoo/events","assignees_url":"https://api.github.com/repos/siplabs/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/siplabs/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/siplabs/kazoo/tags","blobs_url":"https://api.github.com/repos/siplabs/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/siplabs/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/siplabs/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/siplabs/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/siplabs/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/siplabs/kazoo/languages","stargazers_url":"https://api.github.com/repos/siplabs/kazoo/stargazers","contributors_url":"https://api.github.com/repos/siplabs/kazoo/contributors","subscribers_url":"https://api.github.com/repos/siplabs/kazoo/subscribers","subscription_url":"https://api.github.com/repos/siplabs/kazoo/subscription","commits_url":"https://api.github.com/repos/siplabs/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/siplabs/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/siplabs/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/siplabs/kazoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/siplabs/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/siplabs/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/siplabs/kazoo/merges","archive_url":"https://api.github.com/repos/siplabs/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/siplabs/kazoo/downloads","issues_url":"https://api.github.com/repos/siplabs/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/siplabs/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/siplabs/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/siplabs/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/siplabs/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/siplabs/kazoo/releases{/id}","created_at":"2014-04-16T05:33:28Z","updated_at":"2015-03-03T12:07:43Z","pushed_at":"2015-08-18T06:55:33Z","git_url":"git://github.com/siplabs/kazoo.git","ssh_url":"git@github.com:siplabs/kazoo.git","clone_url":"https://github.com/siplabs/kazoo.git","svn_url":"https://github.com/siplabs/kazoo","homepage":"","size":322847,"stargazers_count":0,"watchers_count":0,"language":"Erlang","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"2600hz:master","ref":"master","sha":"6968abaa50ca08777d9752e65bc5580223648f4b","user":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"repo":{"id":2966241,"name":"kazoo","full_name":"2600hz/kazoo","owner":{"login":"2600hz","id":408801,"avatar_url":"https://avatars.githubusercontent.com/u/408801?v=3","gravatar_id":"","url":"https://api.github.com/users/2600hz","html_url":"https://github.com/2600hz","followers_url":"https://api.github.com/users/2600hz/followers","following_url":"https://api.github.com/users/2600hz/following{/other_user}","gists_url":"https://api.github.com/users/2600hz/gists{/gist_id}","starred_url":"https://api.github.com/users/2600hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2600hz/subscriptions","organizations_url":"https://api.github.com/users/2600hz/orgs","repos_url":"https://api.github.com/users/2600hz/repos","events_url":"https://api.github.com/users/2600hz/events{/privacy}","received_events_url":"https://api.github.com/users/2600hz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/2600hz/kazoo","description":"","fork":false,"url":"https://api.github.com/repos/2600hz/kazoo","forks_url":"https://api.github.com/repos/2600hz/kazoo/forks","keys_url":"https://api.github.com/repos/2600hz/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2600hz/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2600hz/kazoo/teams","hooks_url":"https://api.github.com/repos/2600hz/kazoo/hooks","issue_events_url":"https://api.github.com/repos/2600hz/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/2600hz/kazoo/events","assignees_url":"https://api.github.com/repos/2600hz/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/2600hz/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/2600hz/kazoo/tags","blobs_url":"https://api.github.com/repos/2600hz/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2600hz/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2600hz/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/2600hz/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2600hz/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/2600hz/kazoo/languages","stargazers_url":"https://api.github.com/repos/2600hz/kazoo/stargazers","contributors_url":"https://api.github.com/repos/2600hz/kazoo/contributors","subscribers_url":"https://api.github.com/repos/2600hz/kazoo/subscribers","subscription_url":"https://api.github.com/repos/2600hz/kazoo/subscription","commits_url":"https://api.github.com/repos/2600hz/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/2600hz/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/2600hz/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/2600hz/kazoo/issues/comments{/number}","contents_url":"https://api.github.com/repos/2600hz/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/2600hz/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2600hz/kazoo/merges","archive_url":"https://api.github.com/repos/2600hz/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2600hz/kazoo/downloads","issues_url":"https://api.github.com/repos/2600hz/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/2600hz/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/2600hz/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/2600hz/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2600hz/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/2600hz/kazoo/releases{/id}","created_at":"2011-12-12T18:08:02Z","updated_at":"2015-08-20T09:52:50Z","pushed_at":"2015-08-20T08:45:32Z","git_url":"git://github.com/2600hz/kazoo.git","ssh_url":"git@github.com:2600hz/kazoo.git","clone_url":"https://github.com/2600hz/kazoo.git","svn_url":"https://github.com/2600hz/kazoo","homepage":"","size":552809,"stargazers_count":277,"watchers_count":277,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":18,"forks":143,"open_issues":18,"watchers":277,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1157"},"html":{"href":"https://github.com/2600hz/kazoo/pull/1157"},"issue":{"href":"https://api.github.com/repos/2600hz/kazoo/issues/1157"},"comments":{"href":"https://api.github.com/repos/2600hz/kazoo/issues/1157/comments"},"review_comments":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1157/comments"},"review_comment":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/2600hz/kazoo/pulls/1157/commits"},"statuses":{"href":"https://api.github.com/repos/2600hz/kazoo/statuses/bbd6eed8a497db97a6374d4e9710f7304c469daf"}}}}