Skip to content

Instantly share code, notes, and snippets.

@dugancathal
Created February 2, 2016 21:08
Show Gist options
  • Save dugancathal/d149126a8c7827fadfbb to your computer and use it in GitHub Desktop.
Save dugancathal/d149126a8c7827fadfbb to your computer and use it in GitHub Desktop.
Wrapping HTTParty for more logging
require 'httparty'
class HTTPGetter
include HTTParty
base_uri 'http://google.com'
end
class LoggingDecorator < SimpleDelegator
def initialize(thing, logger)
super(thing)
@logger = logger
end
def get
__getobj__.get("/")
end
end
puts LoggingDecorator.new(HTTPGetter, NullLogger.new).get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment