Skip to content

Commit

Permalink
Added CSS Media Type to Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabzIt committed Sep 6, 2019
1 parent dbd32f8 commit edaaa83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ruby/GrabzIt/grabzit.gemspec
@@ -1,10 +1,10 @@
Gem::Specification.new do |s|
s.name = 'grabzit'
s.version = '3.3.5'
s.version = '3.3.6'
s.license = 'MIT'
s.date = %q{2019-08-23}
s.summary = "GrabzIt Ruby Client"
s.description = "Use GrabzIt to convert HTML or URL's into images, PDF or DOCX documents. These captures have highly customizable options include altering quality, delay, size, browser type, geographic location and much more. Additionally GrabzIt can even convert HTML tables on the web into a CSV or Excel spreadsheet. As well as enabling online video's to be converted into animated GIF's."
s.description = "Use GrabzIt to convert HTML or URL's into images, PDF, rendered HTML or DOCX. These captures have highly customizable options include altering quality, delay, size, browser type, geographic location and much more. Additionally GrabzIt can even convert HTML tables on the web into a CSV or Excel spreadsheet. As well as enabling online video's to be converted into animated GIF's."
s.authors = ["GrabzIt"]
s.require_paths = ["lib"]
s.email = 'support@grabz.it'
Expand Down
20 changes: 18 additions & 2 deletions ruby/GrabzIt/lib/grabzit/pdfoptions.rb
Expand Up @@ -33,6 +33,7 @@ def initialize()
@mergeId = nil
@noCookieNotifications = false
@address = nil
@cssMediaType = nil
end

# @return [Boolean] true if the background of the web page should be included in the PDF
Expand Down Expand Up @@ -74,7 +75,21 @@ def orientation
def orientation=(value)
value = GrabzIt::Utility.nil_check(value).capitalize
@orientation = value
end
end

# @return [String] the CSS Media Type of the PDF to be returned
def cssMediaType
@cssMediaType
end

# Set the CSS Media Type of the PDF to be returned: 'Print' or 'Screen'
#
# @param value [String] CSS Media Type
# @return [void]
def cssMediaType=(value)
value = GrabzIt::Utility.nil_check(value).capitalize
@cssMediaType = value
end

# @return [Boolean] true if the links should be included in the PDF
def includeLinks
Expand Down Expand Up @@ -400,7 +415,7 @@ def _getSignatureString(applicationSecret, callBackURL, url = nil)
items.push(GrabzIt::Utility.nil_check(url))
end

items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.b_to_str(@includeOutline),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_check(@coverURL),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications))
items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.b_to_str(@includeBackground),@pagesize ,@orientation,GrabzIt::Utility.nil_check(@customWaterMarkId),GrabzIt::Utility.b_to_str(@includeLinks),GrabzIt::Utility.b_to_str(@includeOutline),GrabzIt::Utility.nil_check(@title),GrabzIt::Utility.nil_check(@coverURL),GrabzIt::Utility.nil_int_check(@marginTop),GrabzIt::Utility.nil_int_check(@marginLeft),GrabzIt::Utility.nil_int_check(@marginBottom),GrabzIt::Utility.nil_int_check(@marginRight),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),GrabzIt::Utility.nil_int_check(@quality),GrabzIt::Utility.nil_check(@templateId),GrabzIt::Utility.nil_check(@hideElement),GrabzIt::Utility.nil_check(@targetElement),GrabzIt::Utility.nil_check(@exportURL),GrabzIt::Utility.nil_check(@waitForElement),GrabzIt::Utility.nil_check(@encryptionKey),GrabzIt::Utility.b_to_str(@noAds),GrabzIt::Utility.nil_check(@post),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_int_check(@height),GrabzIt::Utility.nil_int_check(@width),GrabzIt::Utility.nil_check(@templateVariables),GrabzIt::Utility.nil_check(@proxy),GrabzIt::Utility.nil_check(@mergeId),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications),GrabzIt::Utility.nil_check(@cssMediaType))

return items.join("|")
end
Expand Down Expand Up @@ -436,6 +451,7 @@ def _getParameters(applicationKey, sig, callBackURL, dataName, dataValue)
params['mergeid'] = GrabzIt::Utility.nil_check(@mergeId)
params['address'] = GrabzIt::Utility.nil_check(@address)
params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
params['media'] = GrabzIt::Utility.nil_check(@cssMediaType)

return params;
end
Expand Down
2 changes: 1 addition & 1 deletion ruby/readme.txt
@@ -1,7 +1,7 @@
GrabzIt 3.3
===========

This library allows you to programmatically convert web pages or HTML into images, DOCX documents, PDF's, CSV's and spreadsheets. Additionally GrabzIt allows you to convert online videos into animated GIF's.
This library allows you to programmatically convert web pages or HTML into images, DOCX, rendered HTML, PDF's, CSV's and spreadsheets. Additionally GrabzIt allows you to convert online videos into animated GIF's.

It is usually best to place these files in their own directory.

Expand Down

0 comments on commit edaaa83

Please sign in to comment.