lib/notifications/client/speaker.rb in notifications-ruby-client-2.9.0 vs lib/notifications/client/speaker.rb in notifications-ruby-client-2.10.0
- old
+ new
@@ -5,10 +5,12 @@
require_relative "request_error"
module Notifications
class Client
class Speaker
+ include ErrorHandling
+
attr_reader :base_url
attr_reader :service_id
attr_reader :secret_token
BASE_PATH = "/v2/notifications".freeze
@@ -119,10 +121,10 @@
# @raise [RequestError] if request is
# not successful
def perform_request!(request)
response = open(request)
if response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)
- raise RequestError.new(response)
+ raise build_error(response)
else
JSON.parse(response.body)
end
end