lib/momento/delete_response.rb in momento-0.1.0 vs lib/momento/delete_response.rb in momento-0.2.0
- old
+ new
@@ -1,32 +1,23 @@
-require 'grpc'
-require 'momento/cacheclient_pb'
+require_relative 'response/error'
module Momento
- # Responses specific to delete.
+ # A response from deleting a key.
class DeleteResponse < Response
- def self.from_block
- response = yield
- rescue GRPC::BadStatus => e
- Error.new(grpc_exception: e)
- else
- raise TypeError unless response.is_a?(Momento::CacheClient::DeleteResponse)
-
- Success.new
- end
-
+ # Was the key deleted?
+ # @return [Boolean]
def success?
false
end
- # The item was deleted from the cache.
+ # @private
class Success < DeleteResponse
def success?
true
end
end
- # There was an error deleting the item from the cache.
+ # @private
class Error < DeleteResponse
include Momento::Response::Error
end
end
end