Class: Songkick::Transport::RackTest
- Defined in:
- lib/songkick/transport/rack_test.rb
Defined Under Namespace
Classes: Client
Constant Summary
Constants inherited from Base
Base::DEFAULT_INSTRUMENTATION_LABEL
Instance Attribute Summary
Attributes inherited from Base
#basic_auth, #host, #instrumenter, #timeout, #user_agent, #user_error_codes
Instance Method Summary collapse
- #endpoint ⇒ Object
- #execute_request(req) ⇒ Object
-
#initialize(app, options = {}) ⇒ RackTest
constructor
A new instance of RackTest.
Methods inherited from Base
#do_verb, #instrumentation_payload_extras, #instrumentation_payload_extras=
Methods included from Base::API
#delete, #get, #head, #options, #patch, #post, #put, #with_basic_auth, #with_headers, #with_params, #with_timeout
Constructor Details
#initialize(app, options = {}) ⇒ RackTest
Returns a new instance of RackTest.
17 18 19 20 |
# File 'lib/songkick/transport/rack_test.rb', line 17 def initialize(app, = {}) super(nil, ) @app = app end |
Instance Method Details
#endpoint ⇒ Object
22 23 24 |
# File 'lib/songkick/transport/rack_test.rb', line 22 def endpoint @app end |
#execute_request(req) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/songkick/transport/rack_test.rb', line 26 def execute_request(req) client = Client.new(@app) Timeout.timeout(req.timeout || @timeout) do req.headers.each { |key, value| client.header(key, value) } response = client.__send__(req.verb, req.path, req.params) process(req, response.status, response.headers, response.body) end end |