{"comment":{"url":"https://api.github.com/repos/rkeblitis/ship-to-me/comments/9224068","html_url":"https://github.com/rkeblitis/ship-to-me/commit/832b13f9fe707ed9f7bcbcbf686a1008698c1db1#commitcomment-9224068","id":9224068,"user":{"login":"bion","id":473671,"avatar_url":"https://avatars.githubusercontent.com/u/473671?v=3","gravatar_id":"","url":"https://api.github.com/users/bion","html_url":"https://github.com/bion","followers_url":"https://api.github.com/users/bion/followers","following_url":"https://api.github.com/users/bion/following{/other_user}","gists_url":"https://api.github.com/users/bion/gists{/gist_id}","starred_url":"https://api.github.com/users/bion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bion/subscriptions","organizations_url":"https://api.github.com/users/bion/orgs","repos_url":"https://api.github.com/users/bion/repos","events_url":"https://api.github.com/users/bion/events{/privacy}","received_events_url":"https://api.github.com/users/bion/received_events","type":"User","site_admin":false},"position":42,"line":38,"path":"app/controllers/packages_controller.rb","commit_id":"832b13f9fe707ed9f7bcbcbf686a1008698c1db1","created_at":"2015-01-09T19:38:18Z","updated_at":"2015-01-09T19:38:18Z","body":"There's enough logic in this controller to justify a class to manage the responsibilities of retrieving and comparing prices (OO design!). Short of that, using private methods could help make this easier to understand. For example:\r\n\r\n```ruby\r\nresponse_hash[:ups_rates] = sort_response_rates(response.rates)\r\n# down below\r\ndef sort_response_rates(rates)\r\n  rates\r\n    .sort_by(&:price)\r\n    .collect {|rate| [rate.service_name, rate.price] }\r\nend\r\n```"}}