Class: Datadog::Core::Transport::HTTP::Adapters::Test::Response

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/datadog/core/transport/http/adapters/test.rb

Overview

Response for test adapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Response

#internal_error?

Constructor Details

#initialize(code, body = nil) ⇒ Response

Returns a new instance of Response.



51
52
53
54
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 51

def initialize(code, body = nil)
  @code = code
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



47
48
49
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 47

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



47
48
49
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 47

def code
  @code
end

Instance Method Details

#client_error?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 72

def client_error?
  code.between?(400, 499)
end

#inspectObject



80
81
82
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 80

def inspect
  "#{super}, code:#{code}"
end

#not_found?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 68

def not_found?
  code == 404
end

#ok?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 60

def ok?
  code.between?(200, 299)
end

#payloadObject



56
57
58
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 56

def payload
  @body
end

#server_error?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 76

def server_error?
  code.between?(500, 599)
end

#unsupported?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/datadog/core/transport/http/adapters/test.rb', line 64

def unsupported?
  code == 415
end