Class: Webpagetest::Response
- Inherits:
-
Object
- Object
- Webpagetest::Response
- Includes:
- Connection
- Defined in:
- lib/webpagetest/response.rb
Overview
Custom response class for Webpagetest test data
Constant Summary collapse
- STATUS_BASE =
'testStatus.php'
- RESULT_BASE =
'jsonResult.php'
Constants included from Connection
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#test_id ⇒ Object
readonly
Returns the value of attribute test_id.
Instance Method Summary collapse
-
#get_status ⇒ Object
Gets the status of the request (code from Susuwatari gem).
-
#initialize(raw_response, running = true) ⇒ Response
constructor
A new instance of Response.
Methods included from Connection
Constructor Details
#initialize(raw_response, running = true) ⇒ Response
Returns a new instance of Response.
12 13 14 15 |
# File 'lib/webpagetest/response.rb', line 12 def initialize(raw_response, running=true) @raw = raw_response @test_id = !running && raw_response.statusCode == 200 ? raw.data.id : raw.data.testId end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
7 8 9 |
# File 'lib/webpagetest/response.rb', line 7 def raw @raw end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
7 8 9 |
# File 'lib/webpagetest/response.rb', line 7 def result @result end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/webpagetest/response.rb', line 7 def status @status end |
#test_id ⇒ Object (readonly)
Returns the value of attribute test_id.
7 8 9 |
# File 'lib/webpagetest/response.rb', line 7 def test_id @test_id end |
Instance Method Details
#get_status ⇒ Object
Gets the status of the request (code from Susuwatari gem)
18 19 20 21 |
# File 'lib/webpagetest/response.rb', line 18 def get_status fetch_status unless status == :completed status end |