{"action":"created","issue":{"url":"https://api.github.com/repos/apotonick/trailblazer/issues/100","labels_url":"https://api.github.com/repos/apotonick/trailblazer/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/apotonick/trailblazer/issues/100/comments","events_url":"https://api.github.com/repos/apotonick/trailblazer/issues/100/events","html_url":"https://github.com/apotonick/trailblazer/issues/100","id":123128471,"number":100,"title":"What's the use of Endpoint?","user":{"login":"davidpelaez","id":313232,"avatar_url":"https://avatars.githubusercontent.com/u/313232?v=3","gravatar_id":"","url":"https://api.github.com/users/davidpelaez","html_url":"https://github.com/davidpelaez","followers_url":"https://api.github.com/users/davidpelaez/followers","following_url":"https://api.github.com/users/davidpelaez/following{/other_user}","gists_url":"https://api.github.com/users/davidpelaez/gists{/gist_id}","starred_url":"https://api.github.com/users/davidpelaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidpelaez/subscriptions","organizations_url":"https://api.github.com/users/davidpelaez/orgs","repos_url":"https://api.github.com/users/davidpelaez/repos","events_url":"https://api.github.com/users/davidpelaez/events{/privacy}","received_events_url":"https://api.github.com/users/davidpelaez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-20T02:42:01Z","updated_at":"2015-12-21T15:53:28Z","closed_at":null,"body":"Hi Nick.\r\n\r\nI tried to understand how Endpoint and Controller are connected but I don't think I get what the Endpoint class does. I wonder if you would you give me a hint to grasp the intention and connect the dots. I was very interested by the comment  that says it `# Encapsulates HTTP-specific logic needed before running an operation.`\r\n\r\nI see in the Operation docs that I can do `res, op = run MyOp` but so far I don't understand what the result would be. Is this the return value of the operation process method? Do you intend to use this as a status signaling optional variable that could be used to match the execution of the operation to HTTP codes in cases where exceptions won't do? Some of these cases are for instance a successful execution of two different operations mapping to different HTTP codes. The first one, listing the items of a resources (`GET /items`) would imply a `200 OK`. However another successful operation creating an item would require a `201 Created`. These are opposed to catching a `::Trailblazer::NotAuthorizedError` and mapping to a `401` there's an extra piece of data to convert the execution to an HTTP status code. \r\n\r\nI wonder if this is somewhat related. Clearly without a way to match a set of params to an operation and handling the HTTP related parts the controllers needs to exist even though with minimal responsibilities. \r\n\r\nSorry for the odd questions about the intention and what it actually does, I really tried to get it on my own before asking. It's just that I have been wondering recently if a mini controller together with `lotus-router` would be enough without all the full blown benefits of the lotus-controller that are not needed when using operations. \r\n\r\nMaybe the whole Endpoint class is related to this and I would be reimplementing a part of something you've already done. Is that what the comment cited about is about?"},"comment":{"url":"https://api.github.com/repos/apotonick/trailblazer/issues/comments/166338184","html_url":"https://github.com/apotonick/trailblazer/issues/100#issuecomment-166338184","issue_url":"https://api.github.com/repos/apotonick/trailblazer/issues/100","id":166338184,"user":{"login":"davidpelaez","id":313232,"avatar_url":"https://avatars.githubusercontent.com/u/313232?v=3","gravatar_id":"","url":"https://api.github.com/users/davidpelaez","html_url":"https://github.com/davidpelaez","followers_url":"https://api.github.com/users/davidpelaez/followers","following_url":"https://api.github.com/users/davidpelaez/following{/other_user}","gists_url":"https://api.github.com/users/davidpelaez/gists{/gist_id}","starred_url":"https://api.github.com/users/davidpelaez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidpelaez/subscriptions","organizations_url":"https://api.github.com/users/davidpelaez/orgs","repos_url":"https://api.github.com/users/davidpelaez/repos","events_url":"https://api.github.com/users/davidpelaez/events{/privacy}","received_events_url":"https://api.github.com/users/davidpelaez/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T15:53:28Z","updated_at":"2015-12-21T15:53:28Z","body":"Why don't we have the `InvalidContract` exception everywhere so that can be rescued together with `::Trailblazer::NotAuthorizedError`? I saw it's being used here for testing purposes I suppose:\r\n\r\nhttps://github.com/apotonick/trailblaxzer/blob/master/lib/trailblazer/operation.rb#L152-L155\r\n\r\nThe only thing is that the errors should be passed as an object, not a string for it to be handled in some way if needed, ej: serializing then in some way."}}