Class: Rets::MeasuringHttpClient
- Inherits:
-
Object
- Object
- Rets::MeasuringHttpClient
- Defined in:
- lib/rets/measuring_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, stats, prefix) ⇒ MeasuringHttpClient
constructor
A new instance of MeasuringHttpClient.
- #save_cookie_store(force = nil) ⇒ Object
Constructor Details
#initialize(http_client, stats, prefix) ⇒ MeasuringHttpClient
Returns a new instance of MeasuringHttpClient.
3 4 5 6 7 |
# File 'lib/rets/measuring_http_client.rb', line 3 def initialize(http_client, stats, prefix) @http_client = http_client @stats = stats @prefix = prefix end |
Instance Method Details
#http_get(url, params = nil, extra_headers = {}) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rets/measuring_http_client.rb', line 9 def http_get(url, params=nil, extra_headers={}) @stats.count("#{@prefix}.http_get_rate") @stats.time("#{@prefix}.http_get") do @http_client.http_get(url, params, extra_headers) end end |
#http_post(url, params, extra_headers = {}) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rets/measuring_http_client.rb', line 16 def http_post(url, params, extra_headers = {}) @stats.count("#{@prefix}.http_post_rate") @stats.time("#{@prefix}.http_post") do @http_client.http_post(url, params, extra_headers) end end |
#save_cookie_store(force = nil) ⇒ Object
23 24 25 |
# File 'lib/rets/measuring_http_client.rb', line 23 def (force=nil) @http_client.(force) end |