class Knowtify::ExconHandler
Attributes
http_client[RW]
Public Class Methods
new()
click to toggle source
# File lib/knowtify/handlers/excon_handler.rb, line 7 def initialize opts = { :idempotent => true, :retry_limit => config.max_retries }.merge(config.http_client_options) opts[:instrumentor] = Excon::StandardInstrumentor if config.debug? # output full request data if debugging @http_client = Excon.new(config.base_url,opts) end
Public Instance Methods
config()
click to toggle source
# File lib/knowtify/handlers/excon_handler.rb, line 34 def config Knowtify.config end
post(request,count=0)
click to toggle source
# File lib/knowtify/handlers/excon_handler.rb, line 22 def post(request,count=0) resp = Knowtify::Response.new(count) resp.raw_response = http_client.post(request_options(request)) resp.body = resp.raw_response.body resp.http_code = resp.raw_response.status if resp.retry? post(request,count + 1) else resp end end
request_options(request)
click to toggle source
# File lib/knowtify/handlers/excon_handler.rb, line 16 def request_options(request) {:path => request.path, :body => request.params.to_json, :headers => request.headers}.merge(request.http_request_options) end