Class: Rets::LockingHttpClient
- Inherits:
-
Object
- Object
- Rets::LockingHttpClient
- Defined in:
- lib/rets/locking_http_client.rb
Instance Method Summary collapse
- #http_get(url, params = nil, extra_headers = {}) ⇒ Object
- #http_post(url, params, extra_headers = {}) ⇒ Object
-
#initialize(http_client, locker, lock_name, options = {}) ⇒ LockingHttpClient
constructor
A new instance of LockingHttpClient.
- #lock_around(&block) ⇒ Object
- #save_cookie_store ⇒ Object
Constructor Details
#initialize(http_client, locker, lock_name, options = {}) ⇒ LockingHttpClient
Returns a new instance of LockingHttpClient.
3 4 5 6 7 8 |
# File 'lib/rets/locking_http_client.rb', line 3 def initialize(http_client, locker, lock_name, ={}) @http_client = http_client @locker = locker @lock_name = lock_name @options = end |
Instance Method Details
#http_get(url, params = nil, extra_headers = {}) ⇒ Object
10 11 12 13 14 |
# 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 = {}) ⇒ Object
16 17 18 19 20 |
# 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) ⇒ Object
26 27 28 29 30 31 32 |
# 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 |
#save_cookie_store ⇒ Object
22 23 24 |
# File 'lib/rets/locking_http_client.rb', line 22 def @http_client. end |