Class: Selenium::WebDriver::DevTools::Response
- Inherits:
-
Object
- Object
- Selenium::WebDriver::DevTools::Response
- Defined in:
- lib/selenium/webdriver/devtools/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#code ⇒ Object
Returns the value of attribute code.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.from(id, encoded_body, params) ⇒ Object
private
Creates response from DevTools message.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id:, code:, body:, headers:) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
Constructor Details
#initialize(id:, code:, body:, headers:) ⇒ Response
Returns a new instance of Response.
43 44 45 46 47 48 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 43 def initialize(id:, code:, body:, headers:) @id = id @code = code @body = body @headers = headers end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
24 25 26 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 24 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
24 25 26 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 24 def code @code end |
#headers ⇒ Object
Returns the value of attribute headers.
24 25 26 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 24 def headers @headers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25 26 27 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 25 def id @id end |
Class Method Details
.from(id, encoded_body, params) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates response from DevTools message.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 32 def self.from(id, encoded_body, params) new( id: id, code: params['responseStatusCode'], body: (Base64.strict_decode64(encoded_body) if encoded_body), headers: params.fetch('responseHeaders', []).each_with_object({}) do |header, hash| hash[header['name']] = header['value'] end ) end |
Instance Method Details
#==(other) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 50 def ==(other) self.class == other.class && id == other.id && code == other.code && body == other.body && headers == other.headers end |
#inspect ⇒ Object
58 59 60 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 58 def inspect %(#<#{self.class.name} @id="#{id}" @code="#{code}") end |