class Poll

This object contains information about a poll.

Public Instance Methods

anonymous?() click to toggle source

True, if the poll is anonymous.

# File lib/objects/poll.rb, line 49
def anonymous?
  @poll.is_anonymous
end
close_date() click to toggle source

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
closed?() click to toggle source

True, if the poll is closed.

# File lib/objects/poll.rb, line 44
def closed?
  @poll.is_closed
end
correct_option_id() click to toggle source

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
explanation() click to toggle source

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
explanation_entities() click to toggle source

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
id() click to toggle source

Unique poll identifier.

# File lib/objects/poll.rb, line 15
def id
  @poll.id
end
open_period() click to toggle source

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
options() click to toggle source

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
question() click to toggle source

Poll question, 1-255 characters.

# File lib/objects/poll.rb, line 20
def question
  @poll.question
end
total_voter_count() click to toggle source

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
type() click to toggle source

Poll type, currently can be “regular” or “quiz”

# File lib/objects/poll.rb, line 54
def type
  @poll.type
end