Module: DiscourseApi::API::Polls

Included in:
Client
Defined in:
lib/discourse_api/api/polls.rb

Instance Method Summary collapse

Instance Method Details

#poll_vote(args) ⇒ Object



6
7
8
9
# File 'lib/discourse_api/api/polls.rb', line 6

def poll_vote(args)
  args = API.params(args).required(:post_id, :poll_name, :options).optional(:created_at)
  put("/polls/vote", args)
end

#poll_voters(args) ⇒ Object



21
22
23
24
25
# File 'lib/discourse_api/api/polls.rb', line 21

def poll_voters(args)
  args = API.params(args).required(:post_id, :poll_name).optional(:opts)
  response = get("/polls/voters.json", args)
  response[:body]
end

#toggle_poll_status(args) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/discourse_api/api/polls.rb', line 11

def toggle_poll_status(args)
  args =
    API
      .params(args)
      .required(:post_id, :poll_name, :status)
      .optional(:api_username)
      .optional(:raise_errors)
  put("/polls/toggle_status", args)
end