class Fluidinfo::Response
An instance of {Fluidinfo::Response} is returned by all of the {Fluidinfo::Client} calls. There’s no reason to instantiate one yourself.
Attributes
content[R]
- String, nil
-
The raw response
error[R]
- String
-
The error, if any, returned by
Fluidinfo
headers[R]
- Hash
-
The returned headers.
status[R]
- Integer
-
The return code of the API call.
value[R]
- Hash, String
-
The parsed response if the
Content-Type
was one of {Fluidinfo::JSON_TYPES}, otherwise equivalent to {#content}.
Public Class Methods
new(response)
click to toggle source
# File lib/fluidinfo/response.rb, line 21 def initialize(response) @status = response.code @headers = response.headers @error = @headers[:x_fluiddb_error_class] @content = response.body @value = if JSON_TYPES.include? @headers[:content_type] Yajl.load @content else @content end end
Public Instance Methods
[](key)
click to toggle source
A shortcut for +Response.value#[]+.
# File lib/fluidinfo/response.rb, line 35 def [](key) @value[key] end