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.
44 45 46 47 48 49 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 44 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.
25 26 27 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 25 def body @body end |
#code ⇒ Object
Returns the value of attribute code.
25 26 27 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 25 def code @code end |
#headers ⇒ Object
Returns the value of attribute headers.
25 26 27 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 25 def headers @headers end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26 27 28 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 26 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.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 33 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
51 52 53 54 55 56 57 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 51 def ==(other) self.class == other.class && id == other.id && code == other.code && body == other.body && headers == other.headers end |
#inspect ⇒ Object
59 60 61 |
# File 'lib/selenium/webdriver/devtools/response.rb', line 59 def inspect %(#<#{self.class.name} @id="#{id}" @code="#{code}") end |