Class: HttpStub::Client::Session
- Inherits:
-
Object
- Object
- HttpStub::Client::Session
- Defined in:
- lib/http_stub/client/session.rb
Instance Method Summary collapse
- #activate!(*scenario_names) ⇒ Object
- #delete! ⇒ Object
-
#initialize(id, server) ⇒ Session
constructor
A new instance of Session.
- #reset! ⇒ Object
Constructor Details
#initialize(id, server) ⇒ Session
Returns a new instance of Session.
6 7 8 9 10 |
# File 'lib/http_stub/client/session.rb', line 6 def initialize(id, server) @session_id = id @server = server @description = "session '#{@session_id}'" end |
Instance Method Details
#activate!(*scenario_names) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/http_stub/client/session.rb', line 12 def activate!(*scenario_names) parameters = { http_stub_session_id: @session_id, "names[]" => scenario_names } @server.submit!( method: :post, path: "scenarios/activate", parameters: parameters, intent: "activate scenarios #{scenario_names.map { |name| "'#{name}'" }.join(", ")} in #{@description}" ) end |
#delete! ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/http_stub/client/session.rb', line 31 def delete! @server.submit!( method: :delete, path: "sessions", parameters: { http_stub_session_id: @session_id }, intent: "delete #{@description}" ) end |
#reset! ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/http_stub/client/session.rb', line 22 def reset! @server.submit!( method: :post, path: "stubs/reset", parameters: { http_stub_session_id: @session_id }, intent: "reset stubs in #{@description}" ) end |