lib/arborist/client.rb in arborist-0.0.1.pre20160106113421 vs lib/arborist/client.rb in arborist-0.0.1.pre20160128152542
- old
+ new
@@ -115,9 +115,25 @@
return self.pack_message( :subscribe, header, criteria )
end
+ ### Remove a subscription
+ def unsubscribe( *args )
+ request = self.make_unsubscribe_request( *args )
+ response = self.send_tree_api_request( request )
+ return response
+ end
+
+
+ ### Remove the subscription with the specified +subid+.
+ def make_unsubscribe_request( subid )
+ self.log.debug "Making unsubscribe request for subid: %s" % [ subid ]
+
+ return self.pack_message( :unsubscribe, subscription_id: subid )
+ end
+
+
### Send the packed +request+ via the Tree API socket, raise an error on
### unsuccessful response, and return the response body.
def send_tree_api_request( request )
self.log.debug "Sending request: %p" % [ request ]
self.tree_api.send( request )