Class: Applitools::Selenium::RGridDom
- Inherits:
-
Object
- Object
- Applitools::Selenium::RGridDom
- Includes:
- Jsonable
- Defined in:
- lib/applitools/selenium/rgrid_dom.rb
Constant Summary collapse
- CONTENT_TYPE =
'x-applitools-html/cdt'.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#dom_nodes ⇒ Object
Returns the value of attribute dom_nodes.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #calculate_sha_256 ⇒ Object
-
#content ⇒ Object
def hash calculate_sha_256 end.
-
#initialize(*args) ⇒ RGridDom
constructor
A new instance of RGridDom.
- #resource ⇒ Object
Constructor Details
#initialize(*args) ⇒ RGridDom
Returns a new instance of RGridDom.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 9 def initialize(*args) = Applitools::Utils. args self.url = [:url] self.dom_nodes = [:dom_nodes] self.resources = [:resources] self.hash_format = 'sha256' self.data = { 'resources' => resources, 'domNodes' => dom_nodes } self.hash = calculate_sha_256 end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 7 def data @data end |
#dom_nodes ⇒ Object
Returns the value of attribute dom_nodes.
7 8 9 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 7 def dom_nodes @dom_nodes end |
#resources ⇒ Object
Returns the value of attribute resources.
7 8 9 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 7 def resources @resources end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 7 def url @url end |
Instance Method Details
#calculate_sha_256 ⇒ Object
22 23 24 25 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 22 def calculate_sha_256 # str = Applitools::Utils.stringify_for_hash(data) Digest::SHA256.hexdigest(content) end |
#content ⇒ Object
def hash
calculate_sha_256
end
31 32 33 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 31 def content Oj.dump(json_value(data.sort.to_h)) end |
#resource ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/applitools/selenium/rgrid_dom.rb', line 35 def resource Applitools::Selenium::VGResource.new( url, CONTENT_TYPE, content ) end |