Class: Capybara::Apparition::NetworkTraffic::Request
- Inherits:
-
Object
- Object
- Capybara::Apparition::NetworkTraffic::Request
- Defined in:
- lib/capybara/apparition/network_traffic/request.rb
Instance Attribute Summary collapse
-
#blocked_params ⇒ Object
writeonly
Sets the attribute blocked_params.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_parts ⇒ Object
readonly
Returns the value of attribute response_parts.
Instance Method Summary collapse
- #blocked? ⇒ Boolean
- #error ⇒ Object
- #headers ⇒ Object
-
#initialize(data, response_parts = []) ⇒ Request
constructor
A new instance of Request.
- #method ⇒ Object
- #request_id ⇒ Object
- #time ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(data, response_parts = []) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 8 def initialize(data, response_parts = []) @data = data @response_parts = response_parts @response = nil @blocked_params = nil end |
Instance Attribute Details
#blocked_params=(value) ⇒ Object (writeonly)
Sets the attribute blocked_params
6 7 8 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 6 def blocked_params=(value) @blocked_params = value end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 5 def response @response end |
#response_parts ⇒ Object (readonly)
Returns the value of attribute response_parts.
5 6 7 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 5 def response_parts @response_parts end |
Instance Method Details
#blocked? ⇒ Boolean
39 40 41 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 39 def blocked? !@blocked_params.nil? end |
#error ⇒ Object
43 44 45 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 43 def error response_parts.last&.error end |
#headers ⇒ Object
31 32 33 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 31 def headers @data[:request]&.dig('headers') end |
#method ⇒ Object
27 28 29 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 27 def method @data[:request]&.dig('method') end |
#request_id ⇒ Object
19 20 21 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 19 def request_id @data[:request_id] end |
#time ⇒ Object
35 36 37 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 35 def time @data[:timestamp] && Time.parse(@data[:timestamp]) end |
#url ⇒ Object
23 24 25 |
# File 'lib/capybara/apparition/network_traffic/request.rb', line 23 def url @data[:request]&.dig('url') end |