Class: Applitools::Selenium::VGResource
- Inherits:
-
Object
- Object
- Applitools::Selenium::VGResource
- Includes:
- Jsonable
- Defined in:
- lib/applitools/selenium/visual_grid/vg_resource.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url, content_type, content) ⇒ VGResource
constructor
A new instance of VGResource.
- #stringify ⇒ Object
Constructor Details
#initialize(url, content_type, content) ⇒ VGResource
Returns a new instance of VGResource.
25 26 27 28 29 30 31 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 25 def initialize(url, content_type, content) self.url = URI(url) self.content_type = content_type self.content = content self.hash = Digest::SHA256.hexdigest(content) self.hashFormat = 'sha256' end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 8 def content @content end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 8 def url @url end |
Class Method Details
.parse_blob_from_script(blob) ⇒ Object
13 14 15 16 17 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 13 def parse_blob_from_script(blob) content = Base64.decode64(blob["value"]) # puts "#{blob['url']} ===> #{blob['type']}" self.new blob["url"], blob["type"], content end |
.parse_response(url, response) ⇒ Object
19 20 21 22 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 19 def parse_response(url, response) return self.new(url, 'application/empty-response', '') unless response.status == 200 self.new(url, response.headers['Content-Type'], response.body) end |
Instance Method Details
#stringify ⇒ Object
33 34 35 |
# File 'lib/applitools/selenium/visual_grid/vg_resource.rb', line 33 def stringify url.to_s + content_type.to_s + hash end |