Get a Free Trial

GrabzIt Client with Ruby

Download
Ruby API

Description

This class handles all communication with the GrabzIt screenshot web services.

Public Methods

get_result(id)

This method returns the screenshot itself. If nothing is returned then something has gone wrong or the screenshot is not ready yet.

Parameters

Return Value

The capture


url_to_animation(url, options = nil)

Specifiy the URL of the online video that should be converted into a animated GIF.

Parameters

Return Value

void

AnimationOptions

The class represents all of the options available when creating an animated GIF.

Public Properties


url_to_image(url, options = nil)

Specifies the URL that should be converted into a image screenshot.

Parameters

Return Value

void

html_to_image(html, options = nil)

Specifies the HTML that should be converted into a image.

Parameters

Return Value

void

file_to_image(path, options = nil)

Specifies a HTML file that should be converted into a image.

Parameters

Return Value

void

ImageOptions

The class represents all of the options available when creating image captures.

Public Properties

Public Methods


url_to_video(url, options = nil)

Specifies the URL that should be converted into a video.

Parameters

Return Value

void

html_to_video(html, options = nil)

Specifies the HTML that the video should be captured from.

Parameters

Return Value

void

file_to_video(path, options = nil)

Specifies a HTML file that should be converted into a video.

Parameters

Return Value

void

VideoOptions

The class represents all of the options available when creating a video of a webpage.

Public Properties

Public Methods


url_to_rendered_html(url, options = nil)

Specifies the URL that should be converted into rendered HTML.

Parameters

Return Value

void

html_to_rendered_html(html, options = nil)

Specifies the HTML that should be converted into rendered HTML.

Parameters

Return Value

void

file_to_rendered_html(path, options = nil)

Specifies a HTML file that should be converted into rendered HTML.

Parameters

Return Value

void

HTMLOptions

The class represents all of the options available when creating rendered HTML captures.

Public Properties

Public Methods


url_to_pdf(url, options = nil)

Specifies the URL that should be converted into a PDF.

Parameters

Return Value

void

html_to_pdf(html, options = nil)

Specifies the HTML that should be converted into a PDF.

Parameters

Return Value

void

file_to_pdf(path, options = nil)

Specifies a HTML file that should be converted into a PDF.

Parameters

Return Value

void

PDFOptions

The class represents all of the options available when creating PDF captures.

Public Properties

Public Methods


url_to_docx(url, options = nil)

Specifies the URL that should be converted into a DOCX.

Parameters

Return Value

void

html_to_docx(html, options = nil)

Specifies the HTML that should be converted into a DOCX.

Parameters

Return Value

void

file_to_docx(path, options = nil)

Specifies a HTML file that should be converted into a DOCX.

Parameters

Return Value

void

DOCXOptions

The class represents all of the options available when creating DOCX captures.

Public Properties

Public Methods


url_to_table(url, options = nil)

Specifies the URL that the HTML tables should be extracted from.

Parameters

Return Value

void

html_to_table(html, options = nil)

Specifies the HTML that the HTML tables should be extracted from.

Parameters

Return Value

void

file_to_table(path, options = nil)

Specifies a HTML file that the HTML tables should be extracted from.

Parameters

Return Value

void

TableOptions

The class represents all of the options available when converting HTML tables to CSV, XLSX or JSON.

Public Properties

Public Methods


This is the recommended method of saving a file

save(callBackURL = nil)

Save the result asynchronously and returns a unique identifier, which can be used to get the screenshot with the get_result method.

Parameters

Return Value

The unique identifier of the screenshot otherwise if a error has occured an exception is thrown. This can be used to get the screenshot with the get_result method


Warning this method is synchronous so will cause a application to pause while the result is processed

save_to()

Save the result synchronously to a variable containing the screenshot byte data.

Return Value

returns the byte data of the file if successful otherwise it throws an exception.


Warning this method is synchronous so will cause a application to pause while the result is processed

save_to(saveToFile)

Save the result synchronously to a file.

Parameters

Return Value

returns the true if it is successful otherwise it throws an exception.


get_status(id)

Get the current status of a GrabzIt screenshot.

Parameters

Return Value

ScreenShotStatus object


get_cookies(domain)

Get all the cookies that GrabzIt is using for a particular domain. This may include user defined cookies as well.

Parameters

Return Value

Cookie array


set_cookie(name, domain, value = "", path = "/", httponly = false, expires = "")

Sets a new custom cookie on GrabzIt, if the custom cookie has the same name and domain as a global cookie the global cookie is overridden.

This can be useful if a websites functionality is controlled by cookies.

Parameters

Return Value

True if the cookie is successfully set, otherwise false


delete_cookie(name, domain)

Delete a custom cookie or block a global cookie from being used

Parameters

Return Value

True if the cookie is successfully deleted, otherwise false


get_watermarks()

Get your uploaded custom watermarks

Return Value

WaterMark array


get_watermark(identifier)

Get your uploaded custom watermarks

Parameters

Return Value

WaterMark


add_watermark(identifier, path, xpos, ypos)

Add a new custom watermark

Parameters

Return Value

returns true if the watermark was successfully set


delete_watermark(identifier)

Delete a custom watermark

Parameters

Return Value

returns true if the watermark was successfully deleted


set_local_proxy(value)

This method enables a local proxy server to be used for all requests.

Parameters


use_ssl(value)

Specifies if requests to GrabzIt's API should use SSL

Parameters


create_encryption_key()

Create a cryptographically secure base 64 encryption key, 44 characters long.


decrypt(data, key)

Decrypt an encrypted capture using the provided encryption key.

Parameters


decrypt_file(path, key)

Decrypt an encrypted capture using the provided encryption key.

Parameters


Result Classes

Cookie

Public Properties

ScreenShotStatus

The class representing the current status of the screenshot.

Public Properties

WaterMark

This class represents the custom watermarks stored in GrabzIt

Public Properties