Class: Inferno::CLI::Session::SessionResults
- Inherits:
-
Object
- Object
- Inferno::CLI::Session::SessionResults
- Includes:
- Connection, Errors
- Defined in:
- lib/inferno/apps/cli/session/session_results.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
Instance Method Summary collapse
-
#initialize(session_id, options) ⇒ SessionResults
constructor
A new instance of SessionResults.
- #results_for_session(id) ⇒ Object
- #run ⇒ Object
- #session_results ⇒ Object
Methods included from Errors
#handle_web_api_error, #not_found_error_message, #parse_error_response, #test_run_not_found_message, #text_error_message
Methods included from Connection
#base_url, #check_session_exists, #connection, #delete, #get, #handle_connection_error, #post
Constructor Details
#initialize(session_id, options) ⇒ SessionResults
Returns a new instance of SessionResults.
13 14 15 16 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 13 def initialize(session_id, ) self.session_id = session_id self. = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 11 def @options end |
#session_id ⇒ Object
Returns the value of attribute session_id.
11 12 13 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 11 def session_id @session_id end |
Instance Method Details
#results_for_session(id) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 30 def results_for_session(id) response = get("api/test_sessions/#{id}/results", nil, content_type: 'application/json') handle_web_api_error(response, :session_results) if response.status != 200 JSON.parse(response.body) end |
#run ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 18 def run check_session_exists results = session_results puts JSON.pretty_generate(results) exit(0) end |
#session_results ⇒ Object
26 27 28 |
# File 'lib/inferno/apps/cli/session/session_results.rb', line 26 def session_results @session_results ||= results_for_session(session_id) end |