lib/crunchbase/utilities/request.rb in crunchbase4-0.1.4 vs lib/crunchbase/utilities/request.rb in crunchbase4-0.1.5

- old
+ new

@@ -7,11 +7,15 @@ require_relative '../errors' module Crunchbase # Utilities module Utilities - # API Request + # Key Reminder + # + # entity_id must be provided in the request + # entity_id can be the uuid or the permalink of the entity + # you can pass your API key in the request's header if you do not want to pass the API key in the URL module Request module_function # Autocompletes endpoint def get(uri, *args) @@ -54,10 +58,10 @@ faraday.response :logger, ::Logger.new(STDOUT), bodies: true if debug_mode? end.get(uri, *args) return response.body if response.status == 200 - raise Error, response.body['error'] + raise Error, response.status == 400 ? response.body[0]['message'] : response.body['error'] end def debug_mode? Crunchbase.config.debug || false end