class PeopleDoc::ResponseHandlers::V1::HandleBadRequest

Public Instance Methods

call() click to toggle source
# File lib/people_doc/response_handlers.rb, line 59
def call
  return unless @httparty.code == 400

  message = if @httparty.parsed_response['errors']
              ErrorsResponse.new(@httparty).call
            elsif @httparty.parsed_response['message']
              MessageResponse.new(@httparty).call
            else
              @httparty.body
            end

  fail BadRequest.new(message, @httparty.parsed_response)
end