lib/ereignishorizont/client.rb
# POSTs a string to the event_girl server.
POSTs a string to the event_girl server.
POSTs a string to the event_girl server .
def send!(title, content = nil)
      uri = URI.parse(url)
      path = uri.path == '' ? '/' : uri.path
      req = Net::HTTP::Post.new(path)
      req['Accept']       = "application/json"
      req['Content-Type'] = "application/json"
      req.body = '{"api_token":"' + api_token + '","incoming_event":{"title":"' + title.to_s + '","content":"' + content.to_s + '"}}'
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = ssl?
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      http.request(req)
    end
def send! ( title , content = nil ) uri = URI . parse ( url ) path = uri . path == '' ? '/' : uri . path req = Net :: HTTP :: Post . new ( path ) req [ 'Accept' ] = "application/json" req [ 'Content-Type' ] = "application/json" req . body = '{"api_token":"' + api_token + '","incoming_event":{"title":"' + title . to_s + '","content":"' + content . to_s + '"}}' http = Net :: HTTP . new ( uri . host , uri . port ) http . use_ssl = ssl? http . verify_mode = OpenSSL :: SSL :: VERIFY_NONE http . request ( req ) end
POSTs a string to the event_girl server.
POSTs a string to the event_girl server .
# Auto-correct missing trailing slash # This is all the post request stuff. # The request format and content type is json # This takes the entered api token and title. This is what is sent. It is a HASH! # The request is sent via HTTP to the host and port. You also get a response # ex: 201 (it worked)
title
<not_specific>
content
<not_specific>