Class: StopangoTester::Report
- Inherits:
-
Struct
- Object
- Struct
- StopangoTester::Report
- Defined in:
- lib/stopango_tester/report.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
Returns the value of attribute record.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #hash ⇒ Object
-
#to_json ⇒ Object
field :named_fid field :url field :time, type: Float field :status.
- #to_s ⇒ Object
Instance Attribute Details
#record ⇒ Object
Returns the value of attribute record
5 6 7 |
# File 'lib/stopango_tester/report.rb', line 5 def record @record end |
#response ⇒ Object
Returns the value of attribute response
5 6 7 |
# File 'lib/stopango_tester/report.rb', line 5 def response @response end |
Instance Method Details
#hash ⇒ Object
21 22 23 |
# File 'lib/stopango_tester/report.rb', line 21 def hash @hash ||= Hash.new end |
#to_json ⇒ Object
field :named_fid field :url field :time, type: Float field :status
11 12 13 14 15 16 17 18 19 |
# File 'lib/stopango_tester/report.rb', line 11 def to_json hash[:named_fid] = record.named_fid hash[:status] = response.code hash[:url] = ::CGI.escape(record.test_url) hash[:time] = response.time hash[:response] = response.body if error? hash[:tester_id] = record.tester_id hash end |
#to_s ⇒ Object
25 26 27 28 29 |
# File 'lib/stopango_tester/report.rb', line 25 def to_s "\nurl: #{URI.decode(hash[:url])}\n" + " status: #{hash[:status]}\n" + " time: #{hash[:time]}" end |