{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-grape/grape/issues/1487","repository_url":"https://api.github.com/repos/ruby-grape/grape","labels_url":"https://api.github.com/repos/ruby-grape/grape/issues/1487/labels{/name}","comments_url":"https://api.github.com/repos/ruby-grape/grape/issues/1487/comments","events_url":"https://api.github.com/repos/ruby-grape/grape/issues/1487/events","html_url":"https://github.com/ruby-grape/grape/issues/1487","id":176191247,"number":1487,"title":"Organization with blocks of methods","user":{"login":"tibbon","id":82880,"avatar_url":"https://avatars.githubusercontent.com/u/82880?v=3","gravatar_id":"","url":"https://api.github.com/users/tibbon","html_url":"https://github.com/tibbon","followers_url":"https://api.github.com/users/tibbon/followers","following_url":"https://api.github.com/users/tibbon/following{/other_user}","gists_url":"https://api.github.com/users/tibbon/gists{/gist_id}","starred_url":"https://api.github.com/users/tibbon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tibbon/subscriptions","organizations_url":"https://api.github.com/users/tibbon/orgs","repos_url":"https://api.github.com/users/tibbon/repos","events_url":"https://api.github.com/users/tibbon/events{/privacy}","received_events_url":"https://api.github.com/users/tibbon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ruby-grape/grape/labels/discuss!","name":"discuss!","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-09-10T17:27:13Z","updated_at":"2016-09-14T15:11:57Z","closed_at":null,"body":"Is there a simple way, to organize the methods with blocks for code folding, organization, etc?\r\n\r\nWhat I'm thinking of using a short version of the example in the README, but wrapping methods and blocks in `group` blocks:\r\n\r\n```ruby\r\nmodule Twitter\r\n  class API < Grape::API\r\n    version 'v1', using: :header, vendor: 'twitter'\r\n    format :json\r\n    prefix :api\r\n\r\n    resource :statuses do\r\n      group :public_timeline do\r\n        desc 'Return a public timeline.'\r\n        get :public_timeline do\r\n          Status.limit(20)\r\n        end\r\n      end\r\n\r\n      group :home_timeline do\r\n        desc 'Return a personal timeline.'\r\n        get :home_timeline do\r\n          authenticate!\r\n          current_user.statuses.limit(20)\r\n        end\r\n      end\r\n\r\n      group :status do\r\n        desc 'Return a status.'\r\n        params do\r\n          requires :id, type: Integer, desc: 'Status id.'\r\n        end\r\n        route_param :id do\r\n          get do\r\n            Status.find(params[:id])\r\n          end\r\n        end\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nI'm finding the only way I can get this right now is to use Ruby's open classes, and then having a separate definition for each one. It feels weird for `desc` and `params` to not be block based, but rather order based. "},"comment":{"url":"https://api.github.com/repos/ruby-grape/grape/issues/comments/247046123","html_url":"https://github.com/ruby-grape/grape/issues/1487#issuecomment-247046123","issue_url":"https://api.github.com/repos/ruby-grape/grape/issues/1487","id":247046123,"user":{"login":"dblock","id":542335,"avatar_url":"https://avatars.githubusercontent.com/u/542335?v=3","gravatar_id":"","url":"https://api.github.com/users/dblock","html_url":"https://github.com/dblock","followers_url":"https://api.github.com/users/dblock/followers","following_url":"https://api.github.com/users/dblock/following{/other_user}","gists_url":"https://api.github.com/users/dblock/gists{/gist_id}","starred_url":"https://api.github.com/users/dblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dblock/subscriptions","organizations_url":"https://api.github.com/users/dblock/orgs","repos_url":"https://api.github.com/users/dblock/repos","events_url":"https://api.github.com/users/dblock/events{/privacy}","received_events_url":"https://api.github.com/users/dblock/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T15:11:57Z","updated_at":"2016-09-14T15:11:57Z","body":"It doesn't hurt thanks @connorshea! I wonder if we should combine examples and users or reference one to another. "}}
{"actor":{"display_login":"dblock"}}