Class: Amazon::Coral::HttpDestinationHandler

Inherits:
Handler show all
Defined in:
lib/amazon/coral/httpdestinationhandler.rb

Overview

Attaches the specified endpoint URI to the outgoing request.

Instance Method Summary collapse

Methods inherited from Handler

#after

Constructor Details

#initialize(endpoint) ⇒ HttpDestinationHandler

Initialize an HttpDestinationHandler with the specified endpoint URI.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/amazon/coral/httpdestinationhandler.rb', line 15

def initialize(endpoint)
  @log = LogFactory.getLog('Amazon::Coral::HttpDestinationHandler')

  @uri = case endpoint
         when URI
             endpoint
         else
           URI.parse(endpoint)
         end
  @uri.path = '/' if @uri.path.nil? || @uri.path.empty?
end

Instance Method Details

#before(job) ⇒ Object



27
28
29
30
31
32
# File 'lib/amazon/coral/httpdestinationhandler.rb', line 27

def before(job)
  job.request[:http_verb] = 'GET'
  job.request[:http_uri] = @uri.clone

  @log.debug "Initial request URI #{@uri}"
end