class Nico::Responder

Public Class Methods

new(subdomain, id, token) click to toggle source
# File lib/nico/room/responder.rb, line 5
def initialize(subdomain, id, token)
  @http = Net::HTTP.new "#{subdomain}.campfirenow.com", 443
  @http.use_ssl = true
  @request = Net::HTTP::Post.new "/room/#{id}/speak.json"
  @request.basic_auth token, 'x'
  @request['Content-Type'] = 'application/json'
end

Public Instance Methods

push(response) click to toggle source
# File lib/nico/room/responder.rb, line 13
def push(response)
  @request.body = {message: {body: response}}.to_json
  @http.request @request
end