Class: Fizzy::CLI::Reactions
- Inherits:
-
Thor
- Object
- Thor
- Fizzy::CLI::Reactions
- Includes:
- Base
- Defined in:
- lib/fizzy/cli/reactions.rb
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#create(content) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fizzy/cli/reactions.rb', line 22 def create(content) path = reaction_path([:card], [:comment]) resp = client.post(path, body: { content: content }) r = resp.body output_detail(r, pairs: [ ["ID", r["id"]], ["Content", r["content"]] ]) end |
#delete(reaction_id) ⇒ Object
35 36 37 38 39 |
# File 'lib/fizzy/cli/reactions.rb', line 35 def delete(reaction_id) path = "#{reaction_path([:card], [:comment])}/#{reaction_id}" client.delete(path) puts "Reaction #{reaction_id} deleted." end |
#list ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/fizzy/cli/reactions.rb', line 11 def list path = reaction_path([:card], [:comment]) data = paginator.all(path) output_list(data, headers: %w[ID Content User]) do |r| [r["id"], r["content"], r.dig("creator", "name")] end end |