class Poll
This object contains information about a poll.¶ ↑
Public Instance Methods
True, if the poll is anonymous.
# File lib/objects/poll.rb, line 49 def anonymous? @poll.is_anonymous end
Optional.
Point in time (Unix timestamp) when the poll will be automatically closed.
# File lib/objects/poll.rb, line 94 def close_date @poll.close_date end
True, if the poll is closed.
# File lib/objects/poll.rb, line 44 def closed? @poll.is_closed end
Optional
. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
# File lib/objects/poll.rb, line 61 def correct_option_id @poll.correct_option_id end
Optional.
Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters.
# File lib/objects/poll.rb, line 67 def explanation @poll.explanation end
Optional.
Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.
# File lib/objects/poll.rb, line 73 def explanation_entities data = @poll.explanation_entities unless data return false end explanations = [] data.each do |exp| explanations << MessageEntity.new(exp) end explanations end
Unique poll identifier.
# File lib/objects/poll.rb, line 15 def id @poll.id end
Optional.
Amount of time in seconds the poll will be active after creation.
# File lib/objects/poll.rb, line 88 def open_period @poll.open_period end
Returns array of PollOption
s. else false is returned.
# File lib/objects/poll.rb, line 25 def options opt = @poll.options unless opt return false end poll_options = [] opt.each do |o| poll_options << PollOption.new(o) end poll_options end
Poll
question, 1-255 characters.
# File lib/objects/poll.rb, line 20 def question @poll.question end
Total number of users that voted in the poll.
# File lib/objects/poll.rb, line 39 def total_voter_count @poll.total_voter_count end
Poll
type, currently can be “regular” or “quiz”
# File lib/objects/poll.rb, line 54 def type @poll.type end