grabzit 2.2.0 → 2.2.1
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/grabzit/client.rb +12 -7
- data/test/test_grabzit.rb +11 -3
- metadata +14 -11
- checksums.yaml +0 -7
data/lib/grabzit/client.rb
CHANGED
@@ -179,7 +179,7 @@ module GrabzIt
|
|
179
179
|
raise GrabzItException.new("No screenshot parameters have been set.", GrabzItException::PARAMETER_MISSING_PARAMETERS)
|
180
180
|
end
|
181
181
|
|
182
|
-
sig =
|
182
|
+
sig = encode(@@signaturePartOne+nil_check(callBackURL)+@@signaturePartTwo)
|
183
183
|
currentRequest = @@request
|
184
184
|
|
185
185
|
currentRequest += CGI.escape(nil_check(callBackURL))+"&sig="+sig
|
@@ -278,7 +278,7 @@ module GrabzIt
|
|
278
278
|
# @return [Array<Cookie>] an array of cookies
|
279
279
|
# @raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError
|
280
280
|
def get_cookies(domain)
|
281
|
-
sig =
|
281
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(domain))
|
282
282
|
|
283
283
|
qs = "key=" +CGI.escape(nil_check(@applicationKey))+"&domain="+CGI.escape(nil_check(domain))+"&sig="+sig
|
284
284
|
|
@@ -316,7 +316,7 @@ module GrabzIt
|
|
316
316
|
# @return [Boolean] returns true if the cookie was successfully set
|
317
317
|
# @raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError
|
318
318
|
def set_cookie(name, domain, value = "", path = "/", httponly = false, expires = "")
|
319
|
-
sig =
|
319
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(name)+"|"+nil_check(domain)+"|"+nil_check(value)+"|"+nil_check(path)+"|"+b_to_str(httponly)+"|"+nil_check(expires)+"|0")
|
320
320
|
|
321
321
|
qs = "key=" +CGI.escape(nil_check(@applicationKey))+"&domain="+CGI.escape(nil_check(domain))+"&name="+CGI.escape(nil_check(name))+"&value="+CGI.escape(nil_check(value))+"&path="+CGI.escape(nil_check(path))+"&httponly="+b_to_str(httponly)+"&expires="+CGI.escape(nil_check(expires))+"&sig="+sig
|
322
322
|
|
@@ -330,7 +330,7 @@ module GrabzIt
|
|
330
330
|
# @return [Boolean] returns true if the cookie was successfully set
|
331
331
|
# @raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError
|
332
332
|
def delete_cookie(name, domain)
|
333
|
-
sig =
|
333
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(name)+"|"+nil_check(domain)+"|1")
|
334
334
|
|
335
335
|
qs = "key=" + CGI.escape(nil_check(@applicationKey))+"&domain="+CGI.escape(nil_check(domain))+"&name="+CGI.escape(nil_check(name))+"&delete=1&sig="+sig
|
336
336
|
|
@@ -369,7 +369,7 @@ module GrabzIt
|
|
369
369
|
if !File.file?(path)
|
370
370
|
raise "File: " + path + " does not exist"
|
371
371
|
end
|
372
|
-
sig =
|
372
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(identifier)+"|"+nil_int_check(xpos)+"|"+nil_int_check(ypos));
|
373
373
|
|
374
374
|
boundary = '--------------------------'+Time.now.to_f.to_s
|
375
375
|
|
@@ -421,7 +421,7 @@ module GrabzIt
|
|
421
421
|
# @return [Boolean] returns true if the watermark was successfully deleted
|
422
422
|
# @raise [RuntimeError] if the GrabzIt service reports an error with the request it will be raised as a RuntimeError
|
423
423
|
def delete_watermark(identifier)
|
424
|
-
sig =
|
424
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(identifier))
|
425
425
|
|
426
426
|
qs = "key=" +CGI.escape(nil_check(@applicationKey))+"&identifier="+CGI.escape(nil_check(identifier))+"&sig="+sig
|
427
427
|
|
@@ -480,7 +480,7 @@ module GrabzIt
|
|
480
480
|
|
481
481
|
private
|
482
482
|
def get_watermarks(identifier = nil)
|
483
|
-
sig =
|
483
|
+
sig = encode(nil_check(@applicationSecret)+"|"+nil_check(identifier))
|
484
484
|
|
485
485
|
qs = "key=" +CGI.escape(nil_check(@applicationKey))+"&identifier="+CGI.escape(nil_check(identifier))+"&sig="+sig
|
486
486
|
|
@@ -564,6 +564,11 @@ module GrabzIt
|
|
564
564
|
end
|
565
565
|
end
|
566
566
|
|
567
|
+
private
|
568
|
+
def encode(text)
|
569
|
+
return Digest::MD5.hexdigest(text.encode('ascii', {:invalid => :replace, :undef => :replace, :replace => '?'}))
|
570
|
+
end
|
571
|
+
|
567
572
|
private
|
568
573
|
def get_result_value(result, field)
|
569
574
|
doc = REXML::Document.new(result)
|
data/test/test_grabzit.rb
CHANGED
@@ -9,10 +9,10 @@ class GrabzItTest < Test::Unit::TestCase
|
|
9
9
|
Screenshot_Path = "test/tmp.jpg"
|
10
10
|
|
11
11
|
def setup
|
12
|
-
@applicationKey = "
|
13
|
-
@applicationSecret = "
|
12
|
+
@applicationKey = "YOUR APPLICATION KEY"
|
13
|
+
@applicationSecret = "YOUR APPLICATION SECRET"
|
14
14
|
#Set to true if the account is subscribed
|
15
|
-
@isSubscribedAccount =
|
15
|
+
@isSubscribedAccount = false
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_application_key
|
@@ -46,6 +46,14 @@ class GrabzItTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_take_unicode_url_image
|
50
|
+
assert_nothing_raised "An error occured when trying to take a image screenshot with a unicode URL" do
|
51
|
+
grabzItClient = GrabzIt::Client.new(@applicationKey, @applicationSecret)
|
52
|
+
grabzItClient.set_image_options("\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0066\u006f\u0072\u0075\u006d\u002e\u0074\u0068\u0061\u0069\u007a\u0061\u002e\u0063\u006f\u006d\u002f\u0074\u0065\u0063\u0068\u006e\u006f\u006c\u006f\u0067\u0079\u002f\u004e\u0065\u0064\u0061\u0061\u002d\u0e08\u0e31\u0e1a\u0e21\u0e37\u0e2d\u002d\u0048\u0079\u0074\u0065\u0072\u0061\u002d\u0e43\u0e2b\u0e49\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23\u0e23\u0e30\u0e1a\u0e1a\u0e27\u0e34\u0e17\u0e22\u0e38\u0e21\u0e32\u0e15\u0e23\u0e10\u0e32\u0e19\u002d\u0054\u0045\u0054\u0052\u0041\u002d\u0e23\u0e30\u0e14\u0e31\u0e1a\u0e40\u0e27\u0e34\u0e25\u0e14\u0e4c\u0e04\u0e25\u0e32\u0e2a\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u002f\u0036\u0033\u0037\u0037\u0035\u0037\u002f".encode('utf-8'))
|
53
|
+
assert_not_nil(grabzItClient.save(), "Failed to take screenshot or a unicode URL")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
def test_save_picture
|
50
58
|
if File.file?(Screenshot_Path)
|
51
59
|
File.delete(Screenshot_Path)
|
metadata
CHANGED
@@ -1,30 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grabzit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- GrabzIt
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-02-11 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
|
-
description: 'Automatically create screenshots of website for free, with GrabzIt.
|
30
|
+
description: ! 'Automatically create screenshots of website for free, with GrabzIt.
|
28
31
|
Screenshots can be output in a variety of formats including: JPEG, PNG, TIFF, BMP,
|
29
32
|
PDF, CSV and XLSX. Additionally GrabzIt allows you to convert online videos into
|
30
33
|
animated GIF''s.'
|
@@ -44,26 +47,26 @@ files:
|
|
44
47
|
- test/test_grabzit.rb
|
45
48
|
homepage: http://grabz.it/api/ruby
|
46
49
|
licenses: []
|
47
|
-
metadata: {}
|
48
50
|
post_install_message:
|
49
51
|
rdoc_options: []
|
50
52
|
require_paths:
|
51
53
|
- lib
|
52
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
53
56
|
requirements:
|
54
|
-
- - '>='
|
57
|
+
- - ! '>='
|
55
58
|
- !ruby/object:Gem::Version
|
56
59
|
version: '0'
|
57
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
58
62
|
requirements:
|
59
|
-
- - '>='
|
63
|
+
- - ! '>='
|
60
64
|
- !ruby/object:Gem::Version
|
61
65
|
version: '0'
|
62
66
|
requirements: []
|
63
67
|
rubyforge_project:
|
64
|
-
rubygems_version:
|
68
|
+
rubygems_version: 1.8.29
|
65
69
|
signing_key:
|
66
|
-
specification_version:
|
70
|
+
specification_version: 3
|
67
71
|
summary: GrabzIt Ruby Client
|
68
72
|
test_files: []
|
69
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 17e5e690195e3db9e04ddb68b01c8452d9e78ef9
|
4
|
-
data.tar.gz: 62c853dc8b70e06b8037839cad0d49ff0b22b304
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: f4504960048214f2855de361bf232b0910ec25b728e6d230392444cda73cf035dc38f3ec85293346ed2f6be0f84659ed5bd78744dbdb5247d560463a081e5e6f
|
7
|
-
data.tar.gz: 82b9b8811d5606238ffbeb4b5ae128856f6a7c9f7a02c9be3c0925e679dd31f470b41eb556efe7b7d59a9b29cb93e0274b4a7aa3a3ef08e6abdc5e4eb475fc4b
|