class SARVEvents::Poll
Attributes
id[RW]
options[RW]
published[RW]
start[RW]
votes[RW]
Public Class Methods
new(poll_event)
click to toggle source
# File lib/sarvevents/poll.rb, line 5 def initialize(poll_event) @id = poll_event["pollId"] @published = false @options = JSON.parse(poll_event["answers"]).map { |opt| opt["key"] } @votes = {} end
Public Instance Methods
published?()
click to toggle source
# File lib/sarvevents/poll.rb, line 12 def published? @published end
to_h()
click to toggle source
# File lib/sarvevents/poll.rb, line 16 def to_h hash = {} instance_variables.each { |var| hash[var[1..-1]] = instance_variable_get(var) } hash end
to_json()
click to toggle source
# File lib/sarvevents/poll.rb, line 22 def to_json hash = {} instance_variables.each { |var| hash[var[1..-1]] = instance_variable_get(var) } hash.to_json end