lib/rrj/janus/responses/response.rb in ruby_rabbitmq_janus-2.1.1 vs lib/rrj/janus/responses/response.rb in ruby_rabbitmq_janus-2.2.0.pre.42
- old
+ new
@@ -9,11 +9,11 @@
# # Read and parse a response to janus.
#
# Read a message in rabbitmq queue. This message is formatted to JSON
# or Hash format. For developpment it's possible to used a `nice` JSON.
class Response
- # Instanciate a response
+ # Instantiate a response
#
# @param [Hash] response_janus
# Request parsing after Janus/RabbitMQ receive a response to request
# sending by user
def initialize(response_janus)
@@ -45,9 +45,16 @@
# @return [Hash] Response to Hash foramt
def to_hash
@request
rescue
raise Errors::Janus::Response::ToHash
+ end
+
+ # Test if response it's an error
+ #
+ # @return [Boolean]
+ def error?
+ @request['janus'].match?('error')
end
private
attr_accessor :request