browshot 1.10.0 → 1.12.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/Gemfile +0 -0
- data/Gemfile.lock +0 -0
- data/LICENSE.txt +0 -0
- data/README.rdoc +0 -0
- data/Rakefile +0 -0
- data/VERSION +1 -1
- data/lib/browshot.rb +12 -4
- data/test/test_browshot.rb +63 -43
- metadata +129 -88
data/Gemfile
CHANGED
File without changes
|
data/Gemfile.lock
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.rdoc
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.12.0
|
data/lib/browshot.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# The library requires an API key from Browshot.
|
2
|
-
# Sign up
|
2
|
+
# Sign up for a free account a http://browshot.com/
|
3
3
|
#
|
4
4
|
# See README.rdoc for more information abouth Browshot
|
5
5
|
# and this library.
|
6
6
|
#
|
7
7
|
# Author:: Julien Sobrier (mailto:jsobrier@browshot.com)
|
8
|
-
# Copyright:: Copyright (c)
|
8
|
+
# Copyright:: Copyright (c) 2013 Browshot
|
9
9
|
# License:: Distributes under the same terms as Ruby
|
10
10
|
|
11
11
|
require 'url'
|
@@ -34,7 +34,7 @@ class Browshot
|
|
34
34
|
|
35
35
|
# Return the API version handled by the library. Note that this library can usually handle new arguments in requests without requiring an update.
|
36
36
|
def api_version()
|
37
|
-
return "1.
|
37
|
+
return "1.12"
|
38
38
|
end
|
39
39
|
|
40
40
|
# Retrieve a screenshot with one call. See http://browshot.com/api/documentation#simple for the full list of possible arguments.
|
@@ -173,6 +173,14 @@ class Browshot
|
|
173
173
|
parameters[:id] = id
|
174
174
|
return return_reply('screenshot/delete', parameters)
|
175
175
|
end
|
176
|
+
|
177
|
+
# Get details about screenshots requested. See http://browshot.com/api/documentation#screenshot_search for the response format.
|
178
|
+
#
|
179
|
+
# +url+:: URL string to match
|
180
|
+
def screenshot_search(url='', parameters={})
|
181
|
+
parameters[:url] = url
|
182
|
+
return return_reply('screenshot/search', parameters)
|
183
|
+
end
|
176
184
|
|
177
185
|
|
178
186
|
# Retrieve the screenshot, or a thumbnail, and save it to a file. See http://browshot.com/api/documentation#screenshot_thumbnails for the response format.
|
@@ -240,7 +248,7 @@ class Browshot
|
|
240
248
|
http.open_timeout = 240
|
241
249
|
http.read_timeout = 240
|
242
250
|
|
243
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
251
|
+
request = Net::HTTP::Get.new(uri.request_uri, {'User-Agent' => 'Browshot Ruby 1.9.1'})
|
244
252
|
if (uri.scheme == 'https')
|
245
253
|
http.use_ssl = true
|
246
254
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
data/test/test_browshot.rb
CHANGED
@@ -14,7 +14,7 @@ class TestBrowshot < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
should "get the API version" do
|
17
|
-
assert_equal '1.
|
17
|
+
assert_equal '1.12', @browshot.api_version()
|
18
18
|
end
|
19
19
|
|
20
20
|
should "get a screenshot with the simple method" do
|
@@ -223,9 +223,9 @@ class TestBrowshot < Test::Unit::TestCase
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
|
226
|
+
should "to retrieve a screenshot with details==0" do
|
227
227
|
screenshot = @browshot.screenshot_create('http://browshot.com/')
|
228
|
-
|
228
|
+
info = @browshot.screenshot_info(screenshot['id'], { 'details' => 0 })
|
229
229
|
|
230
230
|
assert_equal false, info['id'].nil?, "Screenshot ID should be present"
|
231
231
|
assert_equal false, info['status'].nil?, "Screenshot status should be present"
|
@@ -255,9 +255,9 @@ class TestBrowshot < Test::Unit::TestCase
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
-
|
258
|
+
should "to retrieve a screenshot with details==1" do
|
259
259
|
screenshot = @browshot.screenshot_create('http://browshot.com/')
|
260
|
-
|
260
|
+
info = @browshot.screenshot_info(screenshot['id'], { 'details' => 1 })
|
261
261
|
|
262
262
|
assert_equal false, info['id'].nil?, "Screenshot ID should be present"
|
263
263
|
assert_equal false, info['status'].nil?, "Screenshot status should be present"
|
@@ -319,54 +319,55 @@ class TestBrowshot < Test::Unit::TestCase
|
|
319
319
|
end
|
320
320
|
end
|
321
321
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
322
|
+
# Details = 2 by default
|
323
|
+
# should "to retrieve a screenshot with details==3" do
|
324
|
+
# screenshot = @browshot.screenshot_create('http://browshot.com/')
|
325
|
+
# info = @browshot.screenshot_info(screenshot['id'], { 'details' => 3 })
|
326
|
+
#
|
327
|
+
# assert_equal false, info['id'].nil?, "Screenshot ID should be present"
|
328
|
+
# assert_equal false, info['status'].nil?, "Screenshot status should be present"
|
329
|
+
# assert_equal false, info['priority'].nil?, "Screenshot priority should be present"
|
330
|
+
# assert_equal false, info['cost'].nil?, "Screenshot cost should be present"
|
331
|
+
#
|
332
|
+
# if (info['status'] == 'finished')
|
333
|
+
# assert_equal false, info['screenshot_url'].nil?, "Screenshot screenshot_url should be present"
|
334
|
+
# assert_equal false, info['url'].nil?, "Screenshot url should be present"
|
335
|
+
# assert_equal false, info['size'].nil?, "Screenshot size should be present"
|
336
|
+
# assert_equal false, info['width'].nil?, "Screenshot width should be present"
|
337
|
+
# assert_equal false, info['height'].nil?, "Screenshot height should be present"
|
338
|
+
# assert_equal false, info['instance_id'].nil?, "Screenshot instance_id should be present"
|
339
|
+
# assert_equal false, info['final_url'].nil?, "Screenshot final_url should be present"
|
340
|
+
# assert_equal false, info['scale'].nil?, "Screenshot scale should be present"
|
341
|
+
#
|
342
|
+
# assert_equal false, info['response_code'].nil?, "Screenshot response_code should be present"
|
343
|
+
# assert_equal false, info['content_type'].nil?, "Screenshot content_type should be present"
|
344
|
+
#
|
345
|
+
# assert_equal false, info['started'].nil?, "Screenshot started should be present"
|
346
|
+
# assert_equal false, info['finished'].nil?, "Screenshot finished should be present"
|
347
|
+
# assert_equal false, info['load'].nil?, "Screenshot load should be present"
|
348
|
+
# assert_equal false, info['request_time'].nil?, "Screenshot request_time should be present"
|
349
|
+
# assert_equal false, info['content'].nil?, "Screenshot content should be present"
|
350
|
+
#
|
351
|
+
# assert_equal false, info['images'].nil?, "Screenshot images should be present"
|
352
|
+
# assert_equal true, info['images'].length > 0, "Screenshot images should be present"
|
353
|
+
# assert_equal false, info['scripts'].nil?, "Screenshot scripts should be present"
|
354
|
+
# assert_equal false, info['iframes'].nil?, "Screenshot iframes should be present"
|
355
|
+
# assert_equal false, info['embeds'].nil?, "Screenshot embeds should be present"
|
356
|
+
# end
|
356
357
|
end
|
357
358
|
|
358
359
|
should "retrieve the list of screenshots" do
|
359
360
|
screenshots = @browshot.screenshot_list()
|
360
361
|
assert_equal true, screenshots.length > 0, "There should be multiple screenshots"
|
361
362
|
|
362
|
-
|
363
|
+
screenshot_id = 0
|
363
364
|
screenshots.each do |key, screenshot|
|
364
365
|
screenshot_id = key
|
365
366
|
break
|
366
367
|
end
|
367
368
|
|
368
369
|
assert_equal true, screenshot_id.to_i > 0, "Screenshot ID should be positive"
|
369
|
-
|
370
|
+
screenshot = screenshots[screenshot_id]
|
370
371
|
|
371
372
|
assert_equal false, screenshot['id'].nil?, "Screenshot ID should be present"
|
372
373
|
assert_equal false, screenshot['status'].nil?, "Screenshot status should be present"
|
@@ -412,7 +413,7 @@ class TestBrowshot < Test::Unit::TestCase
|
|
412
413
|
screenshots = @browshot.screenshot_list()
|
413
414
|
assert_equal true, screenshots.length > 0, "There should be multiple screenshots"
|
414
415
|
|
415
|
-
|
416
|
+
screenshot_id = 0
|
416
417
|
screenshots.each do |key, screenshot|
|
417
418
|
screenshot_id = key
|
418
419
|
break
|
@@ -440,8 +441,27 @@ class TestBrowshot < Test::Unit::TestCase
|
|
440
441
|
hosting = @browshot.screenshot_share(0)
|
441
442
|
assert_equal 'error', hosting['status'], "Missing screenshot ID"
|
442
443
|
end
|
444
|
+
|
445
|
+
should "Search for screenshots" do
|
446
|
+
screenshots = @browshot.screenshot_search('google.com', { :details => 0 })
|
447
|
+
assert_equal true, screenshots.length > 0, "There should be multiple screenshots"
|
448
|
+
|
449
|
+
screenshot_id = 0
|
450
|
+
screenshots.each do |key, screenshot|
|
451
|
+
screenshot_id = key
|
452
|
+
break
|
453
|
+
end
|
454
|
+
|
455
|
+
assert_equal true, screenshot_id.to_i > 0, "Screenshot ID should be positive"
|
456
|
+
screenshot = screenshots[screenshot_id]
|
457
|
+
|
458
|
+
assert_equal false, screenshot['id'].nil?, "Screenshot ID should be present"
|
459
|
+
assert_equal false, screenshot['status'].nil?, "Screenshot status should be present"
|
460
|
+
assert_equal false, screenshot['priority'].nil?, "Screenshot priority should be present"
|
461
|
+
assert_equal false, screenshot['cost'].nil?, "Screenshot cost should be present"
|
462
|
+
end
|
443
463
|
|
444
|
-
should "
|
464
|
+
should "Retrieve account information" do
|
445
465
|
account = @browshot.account_info()
|
446
466
|
assert_equal false, account['balance'].nil?, "Account balance should be present"
|
447
467
|
assert_equal 0, account['balance'].to_i, "Balance should be empty"
|
metadata
CHANGED
@@ -1,114 +1,149 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: browshot
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 39
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 12
|
9
|
+
- 0
|
10
|
+
version: 1.12.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Julien Sobrier
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2013-10-08 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
prerelease: false
|
15
33
|
name: json
|
16
|
-
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
17
37
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
22
45
|
type: :runtime
|
23
46
|
prerelease: false
|
24
|
-
version_requirements: *215834040
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
47
|
name: url
|
27
|
-
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
28
51
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
33
|
-
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
type: :development
|
34
60
|
prerelease: false
|
35
|
-
version_requirements: *215833300
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
61
|
name: json
|
38
|
-
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
39
65
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
44
73
|
type: :development
|
45
74
|
prerelease: false
|
46
|
-
version_requirements: *215832600
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
75
|
name: url
|
49
|
-
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
50
79
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
55
87
|
type: :development
|
56
88
|
prerelease: false
|
57
|
-
version_requirements: *215831900
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
89
|
name: shoulda
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
- - ! '>='
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
66
|
-
type: :development
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: *217283560
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: bundler
|
71
|
-
requirement: &217282880 !ruby/object:Gem::Requirement
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
72
93
|
none: false
|
73
|
-
requirements:
|
94
|
+
requirements:
|
74
95
|
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 23
|
98
|
+
segments:
|
99
|
+
- 1
|
100
|
+
- 0
|
101
|
+
- 0
|
76
102
|
version: 1.0.0
|
77
103
|
type: :development
|
78
104
|
prerelease: false
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
requirement: &
|
105
|
+
name: bundler
|
106
|
+
version_requirements: *id006
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
83
109
|
none: false
|
84
|
-
requirements:
|
110
|
+
requirements:
|
85
111
|
- - ~>
|
86
|
-
- !ruby/object:Gem::Version
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 7
|
114
|
+
segments:
|
115
|
+
- 1
|
116
|
+
- 6
|
117
|
+
- 4
|
87
118
|
version: 1.6.4
|
88
119
|
type: :development
|
89
120
|
prerelease: false
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
requirement: &
|
121
|
+
name: jeweler
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
94
125
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
99
133
|
type: :development
|
100
134
|
prerelease: false
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
Nook©, PC, etc. The latest API version is detailed at http://browshot.com/api/documentation.'
|
135
|
+
name: rcov
|
136
|
+
version_requirements: *id008
|
137
|
+
description: "Browshot (http://www.browshot.com/) is a web service to easily make screenshots of web pages in any screen size, as any device: iPhone, iPad, Android, Nook\xC2\xA9, PC, etc. The latest API version is detailed at http://browshot.com/api/documentation."
|
105
138
|
email: julien@sobrier.net
|
106
139
|
executables: []
|
140
|
+
|
107
141
|
extensions: []
|
108
|
-
|
142
|
+
|
143
|
+
extra_rdoc_files:
|
109
144
|
- LICENSE.txt
|
110
145
|
- README.rdoc
|
111
|
-
files:
|
146
|
+
files:
|
112
147
|
- Gemfile
|
113
148
|
- Gemfile.lock
|
114
149
|
- LICENSE.txt
|
@@ -118,33 +153,39 @@ files:
|
|
118
153
|
- lib/browshot.rb
|
119
154
|
- test/helper.rb
|
120
155
|
- test/test_browshot.rb
|
156
|
+
has_rdoc: true
|
121
157
|
homepage: http://github.com/juliensobrier/browshot-ruby
|
122
|
-
licenses:
|
158
|
+
licenses:
|
123
159
|
- MIT
|
124
160
|
post_install_message:
|
125
161
|
rdoc_options: []
|
126
|
-
|
162
|
+
|
163
|
+
require_paths:
|
127
164
|
- lib
|
128
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
166
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
segments:
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
135
172
|
- 0
|
136
|
-
|
137
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
version: "0"
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
175
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 3
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
version: "0"
|
143
183
|
requirements: []
|
184
|
+
|
144
185
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.3.7
|
146
187
|
signing_key:
|
147
188
|
specification_version: 3
|
148
|
-
summary: Ruby library for Browshot (L<http://www.browshot.com/>), a web service to
|
149
|
-
create website screenshots.
|
189
|
+
summary: Ruby library for Browshot (L<http://www.browshot.com/>), a web service to create website screenshots.
|
150
190
|
test_files: []
|
191
|
+
|