Sha256: a36ddfe3da0817bc466d647d6c03e8196680a5a5d30b0edcbf4e68a18f69d920

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

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

      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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse_api-2.0.1 lib/discourse_api/api/polls.rb
discourse_api-2.0.0 lib/discourse_api/api/polls.rb