Class: WebkitRemote::Event::NetworkResponse
- Inherits:
-
WebkitRemote::Event
- Object
- WebkitRemote::Event
- WebkitRemote::Event::NetworkResponse
- Defined in:
- lib/webkit_remote/client/network_events.rb
Overview
Emitted right after receiving a response to a network request.
Instance Attribute Summary collapse
-
#loader_id ⇒ String
readonly
Used to correlate events.
-
#resource ⇒ WebkitRemote::Client::NetworkResource
readonly
Information about the resource fetched by this network operation.
-
#response ⇒ WebkitRemote::Client::NetworkResponse
readonly
Information about the HTTP response behind this event.
-
#timestamp ⇒ Number
readonly
The event timestamp.
-
#type ⇒ Symbol
readonly
The type of resource returned by this response; documented values are :document, :font, :image, :other, :script, :stylesheet, :websocket and :xhr.
Attributes inherited from WebkitRemote::Event
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rpc_event, client) ⇒ NetworkResponse
constructor
A new instance of NetworkResponse.
Methods inherited from WebkitRemote::Event
can_receive?, class_for, for, #matches?, register, register_class
Constructor Details
#initialize(rpc_event, client) ⇒ NetworkResponse
Returns a new instance of NetworkResponse.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/webkit_remote/client/network_events.rb', line 193 def initialize(rpc_event, client) super @loader_id = raw_data['loaderId'] if raw_data['response'] @response = WebkitRemote::Client::NetworkResponse.new( raw_data['response']) end @type = (raw_data['type'] || 'other').downcase.to_sym @timestamp = raw_data['timestamp'] @resource = client.network_resource raw_data['requestId'] @resource.set_response @response @resource.set_type @type @resource.add_event self end |
Instance Attribute Details
#loader_id ⇒ String (readonly)
Returns used to correlate events.
190 191 192 |
# File 'lib/webkit_remote/client/network_events.rb', line 190 def loader_id @loader_id end |
#resource ⇒ WebkitRemote::Client::NetworkResource (readonly)
Returns information about the resource fetched by this network operation.
175 176 177 |
# File 'lib/webkit_remote/client/network_events.rb', line 175 def resource @resource end |
#response ⇒ WebkitRemote::Client::NetworkResponse (readonly)
Returns information about the HTTP response behind this event.
179 180 181 |
# File 'lib/webkit_remote/client/network_events.rb', line 179 def response @response end |
#timestamp ⇒ Number (readonly)
Returns the event timestamp.
187 188 189 |
# File 'lib/webkit_remote/client/network_events.rb', line 187 def @timestamp end |
#type ⇒ Symbol (readonly)
Returns the type of resource returned by this response; documented values are :document, :font, :image, :other, :script, :stylesheet, :websocket and :xhr.
184 185 186 |
# File 'lib/webkit_remote/client/network_events.rb', line 184 def type @type end |
Class Method Details
.can_reach?(client) ⇒ Boolean
210 211 212 |
# File 'lib/webkit_remote/client/network_events.rb', line 210 def self.can_reach?(client) client.network_events end |