Exception: NexosisApi::HttpException
- Inherits:
-
StandardError
- Object
- StandardError
- NexosisApi::HttpException
- Defined in:
- lib/nexosis_api/http_exception.rb
Overview
encapsulate errors from the Nexosis API
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(message = "", action = nil, http_obj) ⇒ HttpException
constructor
A new instance of HttpException.
Constructor Details
#initialize(message = "", action = nil, http_obj) ⇒ HttpException
Returns a new instance of HttpException.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nexosis_api/http_exception.rb', line 5 def initialize( = "", action = nil, http_obj) = = nil if(http_obj.is_a?(Hash)) .prepend(http_obj['message'].concat(': ')) unless http_obj['message'].nil? @action = action elsif(http_obj.instance_of?(HTTParty::Response)) = http_obj.parsed_response['message'] = .concat(' || Details: ').concat(http_obj.parsed_response['errorDetails'].to_s) unless http_obj.parsed_response['errorDetails'].nil? @type = http_obj.parsed_response['errorType'] @response = http_obj.response @request = http_obj.request @code = http_obj.code end ||= @message = end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/nexosis_api/http_exception.rb', line 4 def action @action end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
23 24 25 |
# File 'lib/nexosis_api/http_exception.rb', line 23 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/nexosis_api/http_exception.rb', line 4 def @message end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/nexosis_api/http_exception.rb', line 4 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/nexosis_api/http_exception.rb', line 4 def response @response end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
27 28 29 |
# File 'lib/nexosis_api/http_exception.rb', line 27 def type @type end |