Method: Contentful::Management::Response#initialize

Defined in:
lib/contentful/management/response.rb

#initialize(raw, request = nil) ⇒ Response

Returns a new instance of Response.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/contentful/management/response.rb', line 26

def initialize(raw, request = nil)
  @raw = raw
  @request = request
  @status = :ok

  if valid_http_response?
    parse_json!
  elsif no_content_response?
    @status = :no_content
  elsif resource_error?
    parse_contentful_error
  elsif service_unavailable_response?
    service_unavailable_error
  else
    parse_http_error
  end
end