Class: OpenRTB::Client
- Inherits:
-
Object
- Object
- OpenRTB::Client
- Defined in:
- lib/openrtb/client.rb
Defined Under Namespace
Classes: Queue
Instance Attribute Summary collapse
- #logger ⇒ Object
- #max_concurrency ⇒ Object
-
#proxy ⇒ Object
Returns the value of attribute proxy.
- #user_agent ⇒ Object
- #version ⇒ Object
Instance Method Summary collapse
- #execute(&block) ⇒ Object
-
#initialize {|_self| ... } ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize {|_self| ... } ⇒ Client
Returns a new instance of Client.
58 59 60 |
# File 'lib/openrtb/client.rb', line 58 def initialize yield(self) if block_given? end |
Instance Attribute Details
#logger ⇒ Object
62 63 64 |
# File 'lib/openrtb/client.rb', line 62 def logger @logger ||= OpenRTB::NullObject.new end |
#max_concurrency ⇒ Object
66 67 68 |
# File 'lib/openrtb/client.rb', line 66 def max_concurrency @max_concurrency ||= 2 end |
#proxy ⇒ Object
Returns the value of attribute proxy.
10 11 12 |
# File 'lib/openrtb/client.rb', line 10 def proxy @proxy end |
#user_agent ⇒ Object
70 71 72 |
# File 'lib/openrtb/client.rb', line 70 def user_agent @user_agent ||= "OpenRTB Ruby Client #{OpenRTB::VERSION}" end |
#version ⇒ Object
74 75 76 |
# File 'lib/openrtb/client.rb', line 74 def version @version ||= '2.1' end |
Instance Method Details
#execute(&block) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/openrtb/client.rb', line 78 def execute(&block) hydra = Typhoeus::Hydra.new(max_concurrency: max_concurrency) queue = Queue.new(self, hydra) block.call(queue) hydra.run handle_responses(queue.responses) end |