grabzit 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/grabzitclient.rb +7 -5
- metadata +2 -2
data/lib/grabzitclient.rb
CHANGED
@@ -29,12 +29,13 @@ class GrabzItClient
|
|
29
29
|
#customId - A custom identifier that you can pass through to the screenshot webservice. This will be returned with the callback URL you have specified.
|
30
30
|
#format - The format the screenshot should be in: bmp8, bmp16, bmp24, bmp, gif, jpg, png
|
31
31
|
#delay - The number of milliseconds to wait before taking the screenshot
|
32
|
+
#targetElement - The id of the only HTML element in the web page to turn into a screenshot
|
32
33
|
#
|
33
34
|
#This function returns the unique identifier of the screenshot. This can be used to get the screenshot with the GetPicture method.
|
34
35
|
#
|
35
|
-
def take_picture(url, callback = nil, customId = nil, browserWidth = nil, browserHeight = nil, width = nil, height = nil, format = nil, delay = nil)
|
36
|
-
qs = "key=" + URI.escape(@applicationKey) + "&url=" + URI.escape(url) + "&width=" + nil_check(width) + "&height=" + nil_check(height) + "&format=" + nil_check(format) + "&bwidth=" + nil_check(browserWidth) + "&bheight=" + nil_check(browserHeight) + "&callback=" + URI.escape(nil_check(callback)) + "&customid=" + URI.escape(nil_check(customId)) + "&delay=" + nil_check(delay)
|
37
|
-
sig = Digest::MD5.hexdigest(@applicationSecret+"|"+url+"|"+nil_check(callback)+"|"+nil_check(format)+"|"+nil_check(height)+"|"+nil_check(width)+"|"+nil_check(browserHeight)+"|"+nil_check(browserWidth)+"|"+nil_check(customId)+"|"+nil_check(delay))
|
36
|
+
def take_picture(url, callback = nil, customId = nil, browserWidth = nil, browserHeight = nil, width = nil, height = nil, format = nil, delay = nil, targetElement = nil)
|
37
|
+
qs = "key=" + URI.escape(@applicationKey) + "&url=" + URI.escape(url) + "&width=" + nil_check(width) + "&height=" + nil_check(height) + "&format=" + nil_check(format) + "&bwidth=" + nil_check(browserWidth) + "&bheight=" + nil_check(browserHeight) + "&callback=" + URI.escape(nil_check(callback)) + "&customid=" + URI.escape(nil_check(customId)) + "&delay=" + nil_check(delay) + "&target=" + URI.escape(nil_check(targetElement))
|
38
|
+
sig = Digest::MD5.hexdigest(@applicationSecret+"|"+url+"|"+nil_check(callback)+"|"+nil_check(format)+"|"+nil_check(height)+"|"+nil_check(width)+"|"+nil_check(browserHeight)+"|"+nil_check(browserWidth)+"|"+nil_check(customId)+"|"+nil_check(delay)+"|"+nil_check(targetElement))
|
38
39
|
qs = qs + "&sig=" + sig
|
39
40
|
|
40
41
|
result = get(WebServicesBaseURL + "takepicture.ashx?" + qs)
|
@@ -62,11 +63,12 @@ class GrabzItClient
|
|
62
63
|
#outputWidth - The width of the resulting thumbnail in pixels
|
63
64
|
#format - The format the screenshot should be in: bmp8, bmp16, bmp24, bmp, gif, jpg, png
|
64
65
|
#delay - The number of milliseconds to wait before taking the screenshot
|
66
|
+
#targetElement - The id of the only HTML element in the web page to turn into a screenshot
|
65
67
|
#
|
66
68
|
#This function returns the true if it is successfull otherwise it throws an exception.
|
67
69
|
#
|
68
|
-
def save_picture(url, saveToFile, browserWidth = nil, browserHeight = nil, width = nil, height = nil, format = nil, delay = nil)
|
69
|
-
id = take_picture(url, nil, nil, browserWidth, browserHeight, width, height, format, delay)
|
70
|
+
def save_picture(url, saveToFile, browserWidth = nil, browserHeight = nil, width = nil, height = nil, format = nil, delay = nil, targetElement = nil)
|
71
|
+
id = take_picture(url, nil, nil, browserWidth, browserHeight, width, height, format, delay, targetElement)
|
70
72
|
|
71
73
|
#Wait for it to be ready.
|
72
74
|
while true do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grabzit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Automatically create and download website screenshots with GrabzIt for
|
15
15
|
free.
|