Method: UnifiProtect::API#request_with_raw_response

Defined in:
lib/unifi_protect/api.rb

#request_with_raw_response(uri, method: :get, body: nil, exception_class: RequestError) ⇒ Object

Raises:

  • (exception_class)


99
100
101
102
103
104
105
# File 'lib/unifi_protect/api.rb', line 99

def request_with_raw_response(uri, method: :get, body: nil, exception_class: RequestError)
  response = http_client.request(http_request_with_bearer_token(uri, method: method, body: body))

  raise exception_class, "#{response.code} #{response.msg}: #{response.body}" unless response.code == '200'

  response.body
end