Class: Forem::Services::ReactionService
- Inherits:
-
BaseService
- Object
- BaseService
- Forem::Services::ReactionService
- Defined in:
- lib/forem/services/reaction_service.rb
Overview
Service for interacting with the Forem Reactions API.
Reactions are emoji-based responses to articles, comments, and other reactable content (likes, unicorns, bookmarks, etc.). Access via Client#reactions. All methods inject the client's requestor automatically so no additional configuration is required.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Reaction
Create a reaction on a reactable resource.
-
#toggle(params = {}, opts = {}) ⇒ Hash
Toggle a reaction on a reactable resource.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Forem::Services::BaseService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Reaction
Create a reaction on a reactable resource.
38 39 40 |
# File 'lib/forem/services/reaction_service.rb', line 38 def create(params = {}, opts = {}) Reaction.create(params, opts_with_requestor(opts)) end |
#toggle(params = {}, opts = {}) ⇒ Hash
Toggle a reaction on a reactable resource.
If the reaction already exists for the authenticated user it will be destroyed; otherwise a new reaction will be created.
67 68 69 |
# File 'lib/forem/services/reaction_service.rb', line 67 def toggle(params = {}, opts = {}) Reaction.toggle(params, opts_with_requestor(opts)) end |