class StrawpollApi
Strawpoll api adapter
Public Instance Methods
create_poll(title, choices)
click to toggle source
# File lib/cinch/plugins/strawpoll/api.rb, line 14 def create_poll(title, choices) response = create_poll_request(title, choices) response end
Private Instance Methods
create_poll_request(title, choices)
click to toggle source
# File lib/cinch/plugins/strawpoll/api.rb, line 21 def create_poll_request(title, choices) options = { headers: { 'Content-Type' => 'application/json' }, body: { title: title, options: choices, multi: false }.to_json } response = self.class.post('/polls', options) JSON.parse(response.body) end