Module: Omdb::Api::Utils
- Included in:
- PublicApi
- Defined in:
- lib/omdb/api/utils.rb
Instance Method Summary collapse
- #_handle_response(resp, klass) ⇒ Object
- #_response_handler(klass) ⇒ Object
- #perform_get(options) ⇒ Object
- #perform_request(request_method, options) ⇒ Object
Instance Method Details
#_handle_response(resp, klass) ⇒ Object
25 26 27 28 29 |
# File 'lib/omdb/api/utils.rb', line 25 def _handle_response(resp, klass) resp.deep_transform_keys! { |k| k.underscore.to_sym } resp.fetch(:response) == 'True' ? klass.new(resp) : Omdb::Api::Types::Error.new(resp) end |
#_response_handler(klass) ⇒ Object
20 21 22 23 |
# File 'lib/omdb/api/utils.rb', line 20 def _response_handler(klass) _handle_response(yield, klass) # rescue Errno::ECONNREFUSED => e end |
#perform_get(options) ⇒ Object
8 9 10 |
# File 'lib/omdb/api/utils.rb', line 8 def perform_get() perform_request(:get, ) end |