Class: Hey::Subscriber
- Inherits:
-
Dispatcher
- Object
- Dispatcher
- Hey::Subscriber
- Defined in:
- lib/hey/subscriber.rb
Overview
Sends requests to the Yo API subscriber endpoint.
Instance Attribute Summary
Attributes inherited from Dispatcher
Class Method Summary collapse
-
.count ⇒ Object
Sends a request to the
subscribers_count
endpoint using the API token set on the Hey module.
Instance Method Summary collapse
-
#count ⇒ Object
Sends a request to the
subscribers_count
endpoint.
Methods inherited from Dispatcher
Constructor Details
This class inherits a constructor from Hey::Dispatcher
Class Method Details
.count ⇒ Object
Sends a request to the subscribers_count
endpoint using the API token set on the Hey module.
19 20 21 |
# File 'lib/hey/subscriber.rb', line 19 def self.count new.count end |
Instance Method Details
#count ⇒ Object
Sends a request to the subscribers_count
endpoint. Raises a MissingAPITokenError
error if an API token hasn’t been set on the Hey module or Yo instance.
10 11 12 13 14 15 |
# File 'lib/hey/subscriber.rb', line 10 def count raise_for_missing_api_token! response = get 'subscribers_count' body = get_response_body response body['count'] end |