Exception: Vra::Http::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Vra::Http::Error
- Defined in:
- lib/vra/http.rb
Instance Attribute Summary collapse
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, http_code, response) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, http_code, response) ⇒ Error
Returns a new instance of Error.
157 158 159 160 161 |
# File 'lib/vra/http.rb', line 157 def initialize(, http_code, response) super() @http_code = http_code @response = response end |
Instance Attribute Details
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
149 150 151 |
# File 'lib/vra/http.rb', line 149 def http_code @http_code end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
149 150 151 |
# File 'lib/vra/http.rb', line 149 def response @response end |
Class Method Details
.from_response(http_response) ⇒ Object
151 152 153 154 155 |
# File 'lib/vra/http.rb', line 151 def self.from_response(http_response) body = FFI_Yajl::Parser.parse(http_response.body) || {} = body['message'] || body['serverMessage'] new(, http_response.code, body) end |