Class: Abqari::HttpSafe::Response

Inherits:
Struct
  • Object
show all
Defined in:
lib/abqari/http_safe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



32
33
34
# File 'lib/abqari/http_safe.rb', line 32

def body
  @body
end

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



32
33
34
# File 'lib/abqari/http_safe.rb', line 32

def code
  @code
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



32
33
34
# File 'lib/abqari/http_safe.rb', line 32

def headers
  @headers
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



32
33
34
# File 'lib/abqari/http_safe.rb', line 32

def message
  @message
end

Instance Method Details

#[](name) ⇒ Object

Case-insensitive header lookup — matches Net::HTTPResponse#[] semantics so call sites don't have to remember which casing the server returned.



35
36
37
# File 'lib/abqari/http_safe.rb', line 35

def [](name)
  headers[name.to_s.downcase]
end

#success?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/abqari/http_safe.rb', line 39

def success?
  code.to_i.between?(200, 299)
end