Class: Ferrum::Network::Request
- Inherits:
-
Object
- Object
- Ferrum::Network::Request
- Includes:
- RequestParams
- Defined in:
- lib/ferrum/network/request.rb
Overview
Represents a [Network.Request](chromedevtools.github.io/devtools-protocol/1-3/Network/#type-Request) object.
Instance Method Summary collapse
-
#frame_id ⇒ String
The frame ID of the request.
-
#id ⇒ String
The request ID.
-
#initialize(params) ⇒ Request
constructor
Initializes the request object.
-
#loader_id ⇒ String
The loader ID of the request.
-
#ping? ⇒ Boolean
Determines if a request is of type ping.
-
#time ⇒ Time
The request timestamp.
-
#to_h ⇒ Hash{String => Object}
Converts the request to a Hash.
-
#type ⇒ String
The request resouce type.
-
#type?(value) ⇒ Boolean
Determines if the request is of the given type.
-
#xhr? ⇒ Boolean
Determines if the request is XHR.
Methods included from RequestParams
#headers, #method, #post_data, #url, #url_fragment
Constructor Details
#initialize(params) ⇒ Request
Initializes the request object.
21 22 23 24 |
# File 'lib/ferrum/network/request.rb', line 21 def initialize(params) @params = params @request = @params["request"] end |
Instance Method Details
#frame_id ⇒ String
The frame ID of the request.
70 71 72 |
# File 'lib/ferrum/network/request.rb', line 70 def frame_id @params["frameId"] end |
#id ⇒ String
The request ID.
31 32 33 |
# File 'lib/ferrum/network/request.rb', line 31 def id @params["requestId"] end |
#loader_id ⇒ String
The loader ID of the request.
79 80 81 |
# File 'lib/ferrum/network/request.rb', line 79 def loader_id @params["loaderId"] end |
#ping? ⇒ Boolean
Determines if a request is of type ping.
97 98 99 |
# File 'lib/ferrum/network/request.rb', line 97 def ping? type?("ping") end |
#time ⇒ Time
The request timestamp.
88 89 90 |
# File 'lib/ferrum/network/request.rb', line 88 def time @time ||= Time.strptime(@params["wallTime"].to_s, "%s") end |
#to_h ⇒ Hash{String => Object}
Converts the request to a Hash.
107 108 109 |
# File 'lib/ferrum/network/request.rb', line 107 def to_h @params end |
#type ⇒ String
The request resouce type.
40 41 42 |
# File 'lib/ferrum/network/request.rb', line 40 def type @params["type"] end |
#type?(value) ⇒ Boolean
Determines if the request is of the given type.
52 53 54 |
# File 'lib/ferrum/network/request.rb', line 52 def type?(value) type.downcase == value.to_s.downcase end |
#xhr? ⇒ Boolean
Determines if the request is XHR.
61 62 63 |
# File 'lib/ferrum/network/request.rb', line 61 def xhr? type?("xhr") end |