Class: Rapidomize::Transports::CommonHTTP

Inherits:
BaseTransport show all
Defined in:
lib/rapidomize/transport/http_transport.rb

Overview

CommonHTTP transport is used to send payloads via HTTP protocol It is called common http, since it does not maintain a persistent connection with a server. For CommonHTTP to send data, messages must provide a valid URI of the HTTP endpoint.

Instance Method Summary collapse

Methods inherited from BaseTransport

#receive

Instance Method Details

#deliver(message) ⇒ Net::HTTPResponse

Deliver a message to the URI of the message

Parameters:

  • message (Message)

    a message object with a URI

Returns:

  • (Net::HTTPResponse)

    Response object for the deliver



14
15
16
17
18
19
# File 'lib/rapidomize/transport/http_transport.rb', line 14

def deliver(message)
  # TODO: Add support for other HTTP verbs too. (i.e PUT, GET, UPDATE)
  Net::HTTP.post message.uri,
                 message.payload.to_json,
                 { 'Content-Type' => 'application/json' }
end