Class: CaptureSessions
- Inherits:
-
Object
- Object
- CaptureSessions
- Defined in:
- lib/capture.rb
Instance Method Summary collapse
- #action(session_id, action_type, payload = {}) ⇒ Object
- #close(session_id) ⇒ Object
- #create(options = {}) ⇒ Object
- #get(session_id) ⇒ Object
-
#initialize(client) ⇒ CaptureSessions
constructor
A new instance of CaptureSessions.
Constructor Details
#initialize(client) ⇒ CaptureSessions
Returns a new instance of CaptureSessions.
20 21 22 |
# File 'lib/capture.rb', line 20 def initialize(client) @client = client end |
Instance Method Details
#action(session_id, action_type, payload = {}) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/capture.rb', line 39 def action(session_id, action_type, payload = {}) payload = payload.nil? ? {} : payload raise TypeError, "payload must be a Hash" unless payload.is_a?(Hash) @client.send(:sessions_request, "/#{@client.send(:escape_path, session_id)}/actions", :post, "type" => action_type, "payload" => payload) end |
#close(session_id) ⇒ Object
35 36 37 |
# File 'lib/capture.rb', line 35 def close(session_id) @client.send(:sessions_request, "/#{@client.send(:escape_path, session_id)}", :delete) end |
#create(options = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/capture.rb', line 24 def create( = {}) = .nil? ? {} : raise TypeError, "options must be a Hash" unless .is_a?(Hash) @client.send(:sessions_request, "", :post, ) end |
#get(session_id) ⇒ Object
31 32 33 |
# File 'lib/capture.rb', line 31 def get(session_id) @client.send(:sessions_request, "/#{@client.send(:escape_path, session_id)}", :get) end |