Class: One40Proof::Multi::Base
- Inherits:
-
Object
- Object
- One40Proof::Multi::Base
- Defined in:
- lib/one40_proof/multi/base.rb
Instance Method Summary collapse
- #ads ⇒ Object
-
#initialize(ad_requests, options = {}) ⇒ Base
constructor
Takes an array of hashs that build the requests.
Constructor Details
#initialize(ad_requests, options = {}) ⇒ Base
Takes an array of hashs that build the requests. User can also specify an :on_fail option.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/one40_proof/multi/base.rb', line 11 def initialize(ad_requests, ={}) on_fail = [:on_fail] hydra = Typhoeus::Hydra.new ad_requests.each do |ad_request| url = build_url(ad_request.delete(:method)) params = {:params => turn_keys_to_strings(ad_request)} request = Typhoeus::Request.new(url, params) request.on_complete do |response| handle_response(response, on_fail) end hydra.queue(request) end hydra.run end |
Instance Method Details
#ads ⇒ Object
31 32 33 |
# File 'lib/one40_proof/multi/base.rb', line 31 def ads @ads ||= [] end |