Class: BaseResponsePresenter
- Inherits:
-
Object
- Object
- BaseResponsePresenter
- Defined in:
- lib/metonym/lib/presenters/base_response_presenter.rb
Direct Known Subclasses
Gnews::GnewsResponsePresenter, NewsApi::NewsApiResponsePresenter
Instance Method Summary collapse
Instance Method Details
#generate_formatted_response(response, format) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/metonym/lib/presenters/base_response_presenter.rb', line 4 def generate_formatted_response(response, format) return response if response.is_a?(Hash) && response.key?(:errors) case format when nil response.body when 'json' response.body when 'hash' JSON.parse(response.body) else response.body end end |