class Rets::LockingHttpClient
Public Class Methods
new(http_client, locker, lock_name, options={})
click to toggle source
# File lib/rets/locking_http_client.rb, line 3 def initialize(http_client, locker, lock_name, options={}) @http_client = http_client @locker = locker @lock_name = lock_name @options = options end
Public Instance Methods
http_get(url, params=nil, extra_headers={})
click to toggle source
# File lib/rets/locking_http_client.rb, line 10 def http_get(url, params=nil, extra_headers={}) lock_around do @http_client.http_get(url, params, extra_headers) end end
http_post(url, params, extra_headers = {})
click to toggle source
# File lib/rets/locking_http_client.rb, line 16 def http_post(url, params, extra_headers = {}) lock_around do @http_client.http_post(url, params, extra_headers) end end
lock_around(&block)
click to toggle source
# File lib/rets/locking_http_client.rb, line 26 def lock_around(&block) result = nil @locker.lock(@lock_name, @options) do result = block.call end result end