integrallis/stripe_event — pull request #42 by vandrijevik (2014-10-29 10:44:51+00:00)
Title: Add StripeEvent.listening?

Often, I find it helpful in my retrievers to know whether `StripeEvent` has any registered listeners for a particular event type. This allows me to avoid a `Stripe::Event.retrieve` API call to Stripe if I am not even interested in processing the event. Currently, I do this in my retrievers:

```ruby
class StripeEventRetriever
def call(params)
return nil unless processing_events_of_type?(params[:type])
#
end

private
def processing_events_of_type?(event_type)
namespaced_type = StripeEvent.namespace.call(event_type)
StripeEvent.backend.notifier.listening?(namespaced_type)
end
end
```

Since `StripeEvent.namespace` and `StripeEvent.backend` are internal implementation details, I think it would be nice to provide a `StripeEvent.listening?` API which provides this functionality without exposing users of the gem to notification internals.