Class: MisarBlog::ReactionsResource
- Defined in:
- lib/misarblog/client.rb
Overview
── Resource: Reactions ──────────────────────────────────────────────────────
Instance Method Summary collapse
-
#add(article_id:, type:) ⇒ Object
POST /reactions.
-
#get(article_id:) ⇒ Object
GET /reactions?article_id=.
-
#remove(article_id:, type:) ⇒ Object
DELETE /reactions?article_id=&type=.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from MisarBlog::Resource
Instance Method Details
#add(article_id:, type:) ⇒ Object
POST /reactions
135 136 137 138 |
# File 'lib/misarblog/client.rb', line 135 def add(article_id:, type:) body = compact(article_id: article_id, type: type) Models::ReactionResult.new(@client.request(:post, "/reactions", body)) end |
#get(article_id:) ⇒ Object
GET /reactions?article_id=
129 130 131 132 |
# File 'lib/misarblog/client.rb', line 129 def get(article_id:) qs = query(article_id: article_id) Models::ArticleReactions.new(@client.request(:get, "/reactions#{qs}")) end |
#remove(article_id:, type:) ⇒ Object
DELETE /reactions?article_id=&type=
141 142 143 144 |
# File 'lib/misarblog/client.rb', line 141 def remove(article_id:, type:) qs = query(article_id: article_id, type: type) Models::ReactionResult.new(@client.request(:delete, "/reactions#{qs}")) end |