{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/guide/issues/54","labels_url":"https://api.github.com/repos/meteor/guide/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/meteor/guide/issues/54/comments","events_url":"https://api.github.com/repos/meteor/guide/issues/54/events","html_url":"https://github.com/meteor/guide/issues/54","id":112981273,"number":54,"title":"\"Methods\" package","user":{"login":"tmeasday","id":132554,"avatar_url":"https://avatars.githubusercontent.com/u/132554?v=3","gravatar_id":"","url":"https://api.github.com/users/tmeasday","html_url":"https://github.com/tmeasday","followers_url":"https://api.github.com/users/tmeasday/followers","following_url":"https://api.github.com/users/tmeasday/following{/other_user}","gists_url":"https://api.github.com/users/tmeasday/gists{/gist_id}","starred_url":"https://api.github.com/users/tmeasday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmeasday/subscriptions","organizations_url":"https://api.github.com/users/tmeasday/orgs","repos_url":"https://api.github.com/users/tmeasday/repos","events_url":"https://api.github.com/users/tmeasday/events{/privacy}","received_events_url":"https://api.github.com/users/tmeasday/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/meteor/guide/labels/code","name":"code","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-10-23T09:01:40Z","updated_at":"2015-10-24T05:33:01Z","closed_at":null,"body":"Build a wrapper around methods, of the form:\r\n\r\n```\r\nTodos.methods.insert = new Method({\r\n  name: '/todos/insert',\r\n  validator(doc) => { Todo.Schema.check(doc); },\r\n  permission(doc, userId) => {\r\n    if (!doc.ownerId == userId) {\r\n      throw new ForbiddenException(\"...\");\r\n    }\r\n  },\r\n  body(doc) {\r\n    Todos.insert(doc);\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/meteor/guide/issues/comments/150758108","html_url":"https://github.com/meteor/guide/issues/54#issuecomment-150758108","issue_url":"https://api.github.com/repos/meteor/guide/issues/54","id":150758108,"user":{"login":"tmeasday","id":132554,"avatar_url":"https://avatars.githubusercontent.com/u/132554?v=3","gravatar_id":"","url":"https://api.github.com/users/tmeasday","html_url":"https://github.com/tmeasday","followers_url":"https://api.github.com/users/tmeasday/followers","following_url":"https://api.github.com/users/tmeasday/following{/other_user}","gists_url":"https://api.github.com/users/tmeasday/gists{/gist_id}","starred_url":"https://api.github.com/users/tmeasday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmeasday/subscriptions","organizations_url":"https://api.github.com/users/tmeasday/orgs","repos_url":"https://api.github.com/users/tmeasday/repos","events_url":"https://api.github.com/users/tmeasday/events{/privacy}","received_events_url":"https://api.github.com/users/tmeasday/received_events","type":"User","site_admin":false},"created_at":"2015-10-24T05:33:01Z","updated_at":"2015-10-24T05:33:01Z","body":"@stubailo I was umming and ahhing and then I just assigned you. Wasn't sure about what our decision on outside-of-core coding work assignment was. I figured this one was your baby anyway.\r\n\r\n@aldeed:\r\n 1. Re: `restricted` - I think we are de-emphasizing allow/deny in the guide so we probably won't build that, but'll take PRs and just not mention that feature in the guide. This seems a good approach.\r\n 2. I like the permission required + shortcutting names. Although I think I like something simpler and less magic like:\r\n\r\n  ```js\r\n  // somewhere global\r\n  Permissions.loggedIn = (userId) => { return !!userId; }\r\n  ```\r\n\r\n3. Re: URLs -- so the bit that maybe didn't come through yet is that we were planning on the method `name` being the URL automagically via simple:rest. It's all part of @stubailo's secret plan to turn Meteor into Rails ;)"}}