Class: Responsys::Api::SessionPool
- Inherits:
-
Object
- Object
- Responsys::Api::SessionPool
- Includes:
- Singleton
- Defined in:
- lib/responsys/api/session_pool.rb
Constant Summary collapse
- ACCEPTED_SETTINGS =
[:timeout, :size]
Instance Attribute Summary collapse
-
#pool ⇒ Object
Returns the value of attribute pool.
Instance Method Summary collapse
-
#initialize ⇒ SessionPool
constructor
A new instance of SessionPool.
- #with ⇒ Object
Constructor Details
#initialize ⇒ SessionPool
Returns a new instance of SessionPool.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/responsys/api/session_pool.rb', line 14 def initialize settings = Responsys.configuration.settings[:sessions] params = if settings settings.select { |option, value| ACCEPTED_SETTINGS.include?(option) } else {} end @pool = ConnectionPool.new(params) { Responsys::Api::Session.new } end |
Instance Attribute Details
#pool ⇒ Object
Returns the value of attribute pool.
7 8 9 |
# File 'lib/responsys/api/session_pool.rb', line 7 def pool @pool end |
Instance Method Details
#with ⇒ Object
25 26 27 28 29 |
# File 'lib/responsys/api/session_pool.rb', line 25 def with @pool.with do |session| yield session end end |