lib/vimeo_me2/http/http_request.rb
# Raises an exception if the response does contain a +stat+ different from "ok"
Raises an exception if the response does contain a +stat+ different from "ok"
Raises an exception if the response does contain a + stat + different from " ok "
def validate_response!(call, status)
          raise "empty call" unless call
          log "#{call.code} #{call.msg}"
          log ""
          status = [status] unless status.is_a? Array
          unless status.include? call.code
            if call.response.body.nil? || call.response.body.empty?
              raise RequestFailed.new(call.code, call.msg)
            else
              body = JSON.parse(call.response.body)
              raise RequestFailed.new(call.code, call.msg, body['error'])
            end
          end
        end
def validate_response! ( call , status ) raise "empty call" unless call log "#{call.code} #{call.msg}" log "" status = [ status ] unless status . is_a? Array unless status . include? call . code if call . response . body . nil? || call . response . body . empty? raise RequestFailed . new ( call . code , call . msg ) else body = JSON . parse ( call . response . body ) raise RequestFailed . new ( call . code , call . msg , body [ 'error' ] ) end end end
Raises an exception if the response does contain a +stat+ different from "ok"
Raises an exception if the response does contain a + stat + different from " ok "
call
<not_specific>
status
<not_specific>