grabzit 3.3.4.1 → 3.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e54b7a156348da8b07ac68291a087989bdda1a3d
4
- data.tar.gz: add47bd227816eb7fff782c529712d053b74740b
2
+ SHA256:
3
+ metadata.gz: 5da69eddc38e96180e23be4dba32f6385c2b91e7d255ef8118d87d19b0a8933a
4
+ data.tar.gz: 6b9cc4715644808114913bf3887f2090ae53a05f15e0bdb720799ce48588a01a
5
5
  SHA512:
6
- metadata.gz: 797fd441594b640c6c85c3dbc63d9b9b271291b1c65351578767d31893063719f50dde9bfa7d59722f86292ab737223844f79744ef02e25ad3a8e58101cfc651
7
- data.tar.gz: 942eaa771d1d3445a5a25d11efdd21f46e53c895fe9ff66eaaf350e89915ab53890f0fa9feb050a004e3036bdf259143e42f4bce566ad38dbf66fc54a83e5808
6
+ metadata.gz: 8891fd909276778b78ba6d177779ed4db9e6a8a1cace9c2120a92859d53a3622366d1e71828cb4bc6eca9f6ab355e886dd5681bc6c5309dd4f0a36cd5b5247c2
7
+ data.tar.gz: 6901c0f929e3676f90f448d40ad6c929d84bc8bf90c6d408d5e778d4af26af0905e5ac1712bcbd60c716a9008ce1045451bfe2e12bb25b60fb7c903e11b1e259
@@ -16,6 +16,7 @@ module GrabzIt
16
16
  require File.join(File.dirname(__FILE__), 'exception')
17
17
  require File.join(File.dirname(__FILE__), 'animationoptions')
18
18
  require File.join(File.dirname(__FILE__), 'imageoptions')
19
+ require File.join(File.dirname(__FILE__), 'htmloptions')
19
20
  require File.join(File.dirname(__FILE__), 'tableoptions')
20
21
  require File.join(File.dirname(__FILE__), 'pdfoptions')
21
22
  require File.join(File.dirname(__FILE__), 'docxoptions')
@@ -46,6 +47,8 @@ module GrabzIt
46
47
  private_constant :TakePDF
47
48
  TakeDOCX = "takedocx.ashx"
48
49
  private_constant :TakeDOCX
50
+ TakeHTML = "takehtml.ashx"
51
+ private_constant :TakeHTML
49
52
  TrueString = "True"
50
53
  private_constant :TrueString
51
54
 
@@ -114,6 +117,45 @@ module GrabzIt
114
117
  def file_to_image(path, options = nil)
115
118
  html_to_image(read_file(path), options)
116
119
  end
120
+
121
+ # This method specifies the URL that should be converted into rendered HTML
122
+ #
123
+ # @param url [String] the URL to capture as rendered HTML
124
+ # @param options [HTMLOptions, nil] a instance of the HTMLOptions class that defines any special options to use when creating the rendered HTML
125
+ # @return [void]
126
+ def url_to_rendered_html(url, options = nil)
127
+
128
+ if options == nil
129
+ options = HTMLOptions.new()
130
+ end
131
+
132
+ @request = Request.new(@protocol + WebServicesBaseURLGet + TakeHTML, false, options, url)
133
+ return nil
134
+ end
135
+
136
+ # This method specifies the HTML that should be converted into rendered HTML
137
+ #
138
+ # @param html [String] the HTML to convert into rendered HTML
139
+ # @param options [HTMLOptions, nil] a instance of the HTMLOptions class that defines any special options to use when creating the rendered HTML
140
+ # @return [void]
141
+ def html_to_rendered_html(html, options = nil)
142
+
143
+ if options == nil
144
+ options = HTMLOptions.new()
145
+ end
146
+
147
+ @request = Request.new(@protocol + WebServicesBaseURLPost + TakeHTML, true, options, html)
148
+ return nil
149
+ end
150
+
151
+ # This method specifies a HTML file that should be converted into rendered HTML
152
+ #
153
+ # @param path [String] the file path of a HTML file to convert into rendered HTML
154
+ # @param options [HTMLOptions, nil] a instance of the HTMLOptions class that defines any special options to use when creating rendered HTML
155
+ # @return [void]
156
+ def file_to_rendered_html(path, options = nil)
157
+ html_to_rendered_html(read_file(path), options)
158
+ end
117
159
 
118
160
  # This method specifies the URL that the HTML tables should be extracted from
119
161
  #
@@ -0,0 +1,161 @@
1
+ module GrabzIt
2
+ require File.join(File.dirname(__FILE__), 'baseoptions')
3
+
4
+ # Represents all of the options available when creating rendered HTML
5
+ # @version 3.0
6
+ # @author GrabzIt
7
+ class HTMLOptions < BaseOptions
8
+ def initialize()
9
+ super()
10
+ @browserWidth = nil
11
+ @browserHeight = nil
12
+ @waitForElement = nil
13
+ @requestAs = 0
14
+ @noAds = false
15
+ @noCookieNotifications = false
16
+ @address = nil
17
+ end
18
+
19
+ # @return [Integer] the width of the browser in pixels
20
+ def browserWidth
21
+ @browserWidth
22
+ end
23
+
24
+ # Set the width of the browser in pixels
25
+ #
26
+ # @param value [Integer] the browser width
27
+ # @return [void]
28
+ def browserWidth=(value)
29
+ @browserWidth = value
30
+ end
31
+
32
+ # @return [Integer] the height of the browser in pixels
33
+ def browserHeight
34
+ @browserHeight
35
+ end
36
+
37
+ # Set the height of the browser in pixels. Use -1 to screenshot the whole web page
38
+ #
39
+ # @param value [Integer] the browser height
40
+ # @return [void]
41
+ def browserHeight=(value)
42
+ @browserHeight = value
43
+ end
44
+
45
+ # @return [Integer] get the number of milliseconds to wait before creating the capture
46
+ def delay
47
+ @delay
48
+ end
49
+
50
+ # Set the number of milliseconds to wait before creating the capture
51
+ #
52
+ # @param value [Integer] the delay
53
+ # @return [void]
54
+ def delay=(value)
55
+ @delay = value
56
+ end
57
+
58
+ # @return [String] get the CSS selector of the HTML element in the web page that must be visible before the capture is performed
59
+ def waitForElement
60
+ @waitForElement
61
+ end
62
+
63
+ # Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed
64
+ #
65
+ # @param value [String] the element to wait for
66
+ # @return [void]
67
+ def waitForElement=(value)
68
+ @waitForElement = value
69
+ end
70
+
71
+ # @return [Integer] get which user agent type should be used
72
+ def requestAs
73
+ @requestAs
74
+ end
75
+
76
+ # Set which user agent type should be used: Standard Browser = 0, Mobile Browser = 1, Search Engine = 2 and Fallback Browser = 3
77
+ #
78
+ # @param value [Integer] the browser type
79
+ # @return [void]
80
+ def requestAs=(value)
81
+ @requestAs = value
82
+ end
83
+
84
+ # @return [Boolean] get if adverts should be automatically hidden
85
+ def noAds
86
+ @noAds
87
+ end
88
+
89
+ # Set to true if adverts should be automatically hidden
90
+ #
91
+ # @param value [Boolean] hide adverts
92
+ # @return [void]
93
+ def noAds=(value)
94
+ @noAds = value
95
+ end
96
+
97
+ # @return [Boolean] get if cookie notifications should be automatically hidden
98
+ def noCookieNotifications
99
+ @noCookieNotifications
100
+ end
101
+
102
+ # Set to true if cookie notifications should be automatically hidden
103
+ #
104
+ # @param value [Boolean] hide cookie notifications
105
+ # @return [void]
106
+ def noCookieNotifications=(value)
107
+ @noCookieNotifications = value
108
+ end
109
+
110
+ # @return [String] get the URL to execute the HTML code in
111
+ def address
112
+ @address
113
+ end
114
+
115
+ # Set the URL to execute the HTML code in
116
+ #
117
+ # @param value [String] the address
118
+ # @return [void]
119
+ def address=(value)
120
+ @address = value
121
+ end
122
+
123
+ # Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force
124
+ # GrabzIt to perform a HTTP post.
125
+ #
126
+ # @param name [String] the name of the HTTP Post parameter
127
+ # @param value [String] the value of the HTTP Post parameter
128
+ def add_post_parameter(name, value)
129
+ @post = appendParameter(@post, name, value)
130
+ end
131
+
132
+ # @!visibility private
133
+ def _getSignatureString(applicationSecret, callBackURL, url = nil)
134
+ items = [applicationSecret]
135
+
136
+ if(url != nil)
137
+ items.push(GrabzIt::Utility.nil_check(url))
138
+ end
139
+
140
+ items.push(GrabzIt::Utility.nil_check(callBackURL),GrabzIt::Utility.nil_int_check(@browserHeight),GrabzIt::Utility.nil_int_check(@browserWidth),GrabzIt::Utility.nil_check(@customId),GrabzIt::Utility.nil_int_check(@delay),GrabzIt::Utility.nil_int_check(@requestAs),GrabzIt::Utility.nil_check(@country),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_check(@proxy),GrabzIt::Utility.nil_check(@address),GrabzIt::Utility.b_to_str(@noCookieNotifications))
141
+
142
+ return items.join("|")
143
+ end
144
+
145
+ # @!visibility private
146
+ def _getParameters(applicationKey, sig, callBackURL, dataName, dataValue)
147
+ params = createParameters(applicationKey, sig, callBackURL, dataName, dataValue)
148
+ params['bwidth'] = GrabzIt::Utility.nil_int_check(@browserWidth)
149
+ params['bheight'] = GrabzIt::Utility.nil_int_check(@browserHeight)
150
+ params['delay'] = GrabzIt::Utility.nil_int_check(@delay)
151
+ params['waitfor'] = GrabzIt::Utility.nil_check(@waitForElement)
152
+ params['requestmobileversion'] = GrabzIt::Utility.nil_int_check(@requestAs)
153
+ params['noads'] = GrabzIt::Utility.b_to_str(@noAds)
154
+ params['post'] = GrabzIt::Utility.nil_check(@post)
155
+ params['address'] = GrabzIt::Utility.nil_check(@address)
156
+ params['nonotify'] = GrabzIt::Utility.b_to_str(@noCookieNotifications)
157
+
158
+ return params
159
+ end
160
+ end
161
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grabzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.4.1
4
+ version: 3.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - GrabzIt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-11 00:00:00.000000000 Z
11
+ date: 2019-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -42,6 +42,7 @@ files:
42
42
  - lib/grabzit/cookie.rb
43
43
  - lib/grabzit/docxoptions.rb
44
44
  - lib/grabzit/exception.rb
45
+ - lib/grabzit/htmloptions.rb
45
46
  - lib/grabzit/imageoptions.rb
46
47
  - lib/grabzit/pdfoptions.rb
47
48
  - lib/grabzit/proxy.rb
@@ -71,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  - !ruby/object:Gem::Version
72
73
  version: '0'
73
74
  requirements: []
74
- rubyforge_project:
75
- rubygems_version: 2.4.5.2
75
+ rubygems_version: 3.0.3
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: GrabzIt Ruby Client