grabzit 3.3.7 → 3.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grabzit/client.rb +21 -23
- data/lib/grabzit/exception.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4654aba595bc9a3246880db17f1c330df540f28f1e4fe11a13b4411a3b24540
|
4
|
+
data.tar.gz: 8dc49974901236152f66c396d4e95959f4682f904d46c2a65340ab594d2038c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35160950fc90e189be12bc19477227ef9d3a98629d4a22699394344f5707e26baa3d52b798d654217ff1de3cb4bceff24c689eece425fc43d8ab649fad47fa9
|
7
|
+
data.tar.gz: 6c8d972ef7a1f5225ea78cc4a9fc89efe656a8c1252e9dc56beb60841b84c74aee55ffddd3271b980039aa083d29659100d11a9a99ff0de6cf9c04aaa596f6b5
|
data/lib/grabzit/client.rb
CHANGED
@@ -35,10 +35,8 @@ module GrabzIt
|
|
35
35
|
# @see http://grabz.it/api/ruby/ GrabzIt Ruby API
|
36
36
|
class Client
|
37
37
|
|
38
|
-
|
39
|
-
private_constant :
|
40
|
-
WebServicesBaseURLPost = "://grabz.it/services/"
|
41
|
-
private_constant :WebServicesBaseURLPost
|
38
|
+
WebServicesBaseURL = "://api.grabz.it/services/"
|
39
|
+
private_constant :WebServicesBaseURL
|
42
40
|
TakePicture = "takepicture.ashx"
|
43
41
|
private_constant :TakePicture
|
44
42
|
TakeTable = "taketable.ashx"
|
@@ -75,7 +73,7 @@ module GrabzIt
|
|
75
73
|
options = AnimationOptions.new()
|
76
74
|
end
|
77
75
|
|
78
|
-
@request = Request.new(@protocol +
|
76
|
+
@request = Request.new(@protocol + WebServicesBaseURL + "takeanimation.ashx", false, options, url)
|
79
77
|
return nil
|
80
78
|
end
|
81
79
|
|
@@ -90,7 +88,7 @@ module GrabzIt
|
|
90
88
|
options = ImageOptions.new()
|
91
89
|
end
|
92
90
|
|
93
|
-
@request = Request.new(@protocol +
|
91
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePicture, false, options, url)
|
94
92
|
return nil
|
95
93
|
end
|
96
94
|
|
@@ -105,7 +103,7 @@ module GrabzIt
|
|
105
103
|
options = ImageOptions.new()
|
106
104
|
end
|
107
105
|
|
108
|
-
@request = Request.new(@protocol +
|
106
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePicture, true, options, html)
|
109
107
|
return nil
|
110
108
|
end
|
111
109
|
|
@@ -129,7 +127,7 @@ module GrabzIt
|
|
129
127
|
options = HTMLOptions.new()
|
130
128
|
end
|
131
129
|
|
132
|
-
@request = Request.new(@protocol +
|
130
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeHTML, false, options, url)
|
133
131
|
return nil
|
134
132
|
end
|
135
133
|
|
@@ -144,7 +142,7 @@ module GrabzIt
|
|
144
142
|
options = HTMLOptions.new()
|
145
143
|
end
|
146
144
|
|
147
|
-
@request = Request.new(@protocol +
|
145
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeHTML, true, options, html)
|
148
146
|
return nil
|
149
147
|
end
|
150
148
|
|
@@ -168,7 +166,7 @@ module GrabzIt
|
|
168
166
|
options = TableOptions.new()
|
169
167
|
end
|
170
168
|
|
171
|
-
@request = Request.new(@protocol +
|
169
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeTable, false, options, url)
|
172
170
|
return nil
|
173
171
|
end
|
174
172
|
|
@@ -183,7 +181,7 @@ module GrabzIt
|
|
183
181
|
options = TableOptions.new()
|
184
182
|
end
|
185
183
|
|
186
|
-
@request = Request.new(@protocol +
|
184
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeTable, true, options, html)
|
187
185
|
return nil
|
188
186
|
end
|
189
187
|
|
@@ -207,7 +205,7 @@ module GrabzIt
|
|
207
205
|
options = PDFOptions.new()
|
208
206
|
end
|
209
207
|
|
210
|
-
@request = Request.new(@protocol +
|
208
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePDF, false, options, url)
|
211
209
|
return nil
|
212
210
|
end
|
213
211
|
|
@@ -222,7 +220,7 @@ module GrabzIt
|
|
222
220
|
options = PDFOptions.new()
|
223
221
|
end
|
224
222
|
|
225
|
-
@request = Request.new(@protocol +
|
223
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakePDF, true, options, html)
|
226
224
|
return nil
|
227
225
|
end
|
228
226
|
|
@@ -246,7 +244,7 @@ module GrabzIt
|
|
246
244
|
options = DOCXOptions.new()
|
247
245
|
end
|
248
246
|
|
249
|
-
@request = Request.new(@protocol +
|
247
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeDOCX, false, options, url)
|
250
248
|
return nil
|
251
249
|
end
|
252
250
|
|
@@ -261,7 +259,7 @@ module GrabzIt
|
|
261
259
|
options = DOCXOptions.new()
|
262
260
|
end
|
263
261
|
|
264
|
-
@request = Request.new(@protocol +
|
262
|
+
@request = Request.new(@protocol + WebServicesBaseURL + TakeDOCX, true, options, html)
|
265
263
|
return nil
|
266
264
|
end
|
267
265
|
|
@@ -366,7 +364,7 @@ module GrabzIt
|
|
366
364
|
return nil
|
367
365
|
end
|
368
366
|
|
369
|
-
result = get(@protocol +
|
367
|
+
result = get(@protocol + WebServicesBaseURL + "getstatus.ashx?id=" + GrabzIt::Utility.nil_check(id))
|
370
368
|
|
371
369
|
doc = REXML::Document.new(result)
|
372
370
|
|
@@ -388,7 +386,7 @@ module GrabzIt
|
|
388
386
|
return nil
|
389
387
|
end
|
390
388
|
|
391
|
-
return get(@protocol +
|
389
|
+
return get(@protocol + WebServicesBaseURL + "getfile.ashx?id=" + GrabzIt::Utility.nil_check(id))
|
392
390
|
end
|
393
391
|
|
394
392
|
# Get all the cookies that GrabzIt is using for a particular domain. This may include your user set cookies as well
|
@@ -406,7 +404,7 @@ module GrabzIt
|
|
406
404
|
qs.concat("&sig=")
|
407
405
|
qs.concat(sig)
|
408
406
|
|
409
|
-
result = get(@protocol +
|
407
|
+
result = get(@protocol + WebServicesBaseURL + "getcookies.ashx?" + qs)
|
410
408
|
|
411
409
|
doc = REXML::Document.new(result)
|
412
410
|
|
@@ -461,7 +459,7 @@ module GrabzIt
|
|
461
459
|
qs.concat("&sig=")
|
462
460
|
qs.concat(sig)
|
463
461
|
|
464
|
-
return (get_result_value(get(@protocol +
|
462
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "setcookie.ashx?" + qs), "Result") == TrueString)
|
465
463
|
end
|
466
464
|
|
467
465
|
# Delete a custom cookie or block a global cookie from being used
|
@@ -483,7 +481,7 @@ module GrabzIt
|
|
483
481
|
qs.concat("&delete=1&sig=")
|
484
482
|
qs.concat(sig)
|
485
483
|
|
486
|
-
return (get_result_value(get(@protocol +
|
484
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "setcookie.ashx?" + qs), "Result") == TrueString)
|
487
485
|
end
|
488
486
|
|
489
487
|
# Get your uploaded custom watermark
|
@@ -583,7 +581,7 @@ module GrabzIt
|
|
583
581
|
qs.concat("&sig=")
|
584
582
|
qs.concat(sig)
|
585
583
|
|
586
|
-
return (get_result_value(get(@protocol +
|
584
|
+
return (get_result_value(get(@protocol + WebServicesBaseURL + "deletewatermark.ashx?" + qs), "Result") == TrueString)
|
587
585
|
end
|
588
586
|
|
589
587
|
# This method sets if requests to GrabzIt's API should use SSL or not
|
@@ -667,7 +665,7 @@ module GrabzIt
|
|
667
665
|
qs.concat("&sig=")
|
668
666
|
qs.concat(sig)
|
669
667
|
|
670
|
-
result = get(@protocol +
|
668
|
+
result = get(@protocol + WebServicesBaseURL + "getwatermarks.ashx?" + qs)
|
671
669
|
|
672
670
|
doc = REXML::Document.new(result)
|
673
671
|
|
@@ -707,7 +705,7 @@ module GrabzIt
|
|
707
705
|
if statusCode == 403
|
708
706
|
raise GrabzItException.new(response.body, GrabzItException::NETWORK_DDOS_ATTACK)
|
709
707
|
elsif statusCode >= 400
|
710
|
-
raise GrabzItException.new("A network error
|
708
|
+
raise GrabzItException.new("A network error occurred when connecting to GrabzIt.", GrabzItException::NETWORK_GENERAL_ERROR)
|
711
709
|
end
|
712
710
|
end
|
713
711
|
|
data/lib/grabzit/exception.rb
CHANGED
@@ -72,6 +72,9 @@ module GrabzIt
|
|
72
72
|
PARAMETER_INVALID_PROXY = 173
|
73
73
|
PARAMETER_INVALID_NO_NOTIFY = 174
|
74
74
|
PARAMETER_INVALID_HD = 176
|
75
|
+
PARAMETER_INVALID_MEDIA_TYPE = 177
|
76
|
+
PARAMETER_INVALID_PASSWORD = 178
|
77
|
+
PARAMETER_INVALID_MERGE = 179
|
75
78
|
NETWORK_SERVER_OFFLINE = 200
|
76
79
|
NETWORK_GENERAL_ERROR = 201
|
77
80
|
NETWORK_DDOS_ATTACK = 202
|