webscraping_ai 3.2.1 → 4.0.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.
@@ -1,178 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module WebScrapingAI
17
- class Account < ApiModelBase
18
- # Your account email
19
- attr_accessor :email
20
-
21
- # Remaining API credits quota
22
- attr_accessor :remaining_api_calls
23
-
24
- # Next billing cycle start time (UNIX timestamp)
25
- attr_accessor :resets_at
26
-
27
- # Remaining concurrent requests
28
- attr_accessor :remaining_concurrency
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'email' => :'email',
34
- :'remaining_api_calls' => :'remaining_api_calls',
35
- :'resets_at' => :'resets_at',
36
- :'remaining_concurrency' => :'remaining_concurrency'
37
- }
38
- end
39
-
40
- # Returns attribute mapping this model knows about
41
- def self.acceptable_attribute_map
42
- attribute_map
43
- end
44
-
45
- # Returns all the JSON keys this model knows about
46
- def self.acceptable_attributes
47
- acceptable_attribute_map.values
48
- end
49
-
50
- # Attribute type mapping.
51
- def self.openapi_types
52
- {
53
- :'email' => :'String',
54
- :'remaining_api_calls' => :'Integer',
55
- :'resets_at' => :'Integer',
56
- :'remaining_concurrency' => :'Integer'
57
- }
58
- end
59
-
60
- # List of attributes with nullable: true
61
- def self.openapi_nullable
62
- Set.new([
63
- ])
64
- end
65
-
66
- # Initializes the object
67
- # @param [Hash] attributes Model attributes in the form of hash
68
- def initialize(attributes = {})
69
- if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `WebScrapingAI::Account` initialize method"
71
- end
72
-
73
- # check to see if the attribute exists and convert string to symbol for hash key
74
- acceptable_attribute_map = self.class.acceptable_attribute_map
75
- attributes = attributes.each_with_object({}) { |(k, v), h|
76
- if (!acceptable_attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `WebScrapingAI::Account`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
- end
79
- h[k.to_sym] = v
80
- }
81
-
82
- if attributes.key?(:'email')
83
- self.email = attributes[:'email']
84
- end
85
-
86
- if attributes.key?(:'remaining_api_calls')
87
- self.remaining_api_calls = attributes[:'remaining_api_calls']
88
- end
89
-
90
- if attributes.key?(:'resets_at')
91
- self.resets_at = attributes[:'resets_at']
92
- end
93
-
94
- if attributes.key?(:'remaining_concurrency')
95
- self.remaining_concurrency = attributes[:'remaining_concurrency']
96
- end
97
- end
98
-
99
- # Show invalid properties with the reasons. Usually used together with valid?
100
- # @return Array for valid properties with the reasons
101
- def list_invalid_properties
102
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
- invalid_properties = Array.new
104
- invalid_properties
105
- end
106
-
107
- # Check to see if the all the properties in the model are valid
108
- # @return true if the model is valid
109
- def valid?
110
- warn '[DEPRECATED] the `valid?` method is obsolete'
111
- true
112
- end
113
-
114
- # Checks equality by comparing each attribute.
115
- # @param [Object] Object to be compared
116
- def ==(o)
117
- return true if self.equal?(o)
118
- self.class == o.class &&
119
- email == o.email &&
120
- remaining_api_calls == o.remaining_api_calls &&
121
- resets_at == o.resets_at &&
122
- remaining_concurrency == o.remaining_concurrency
123
- end
124
-
125
- # @see the `==` method
126
- # @param [Object] Object to be compared
127
- def eql?(o)
128
- self == o
129
- end
130
-
131
- # Calculates hash code according to all attributes.
132
- # @return [Integer] Hash code
133
- def hash
134
- [email, remaining_api_calls, resets_at, remaining_concurrency].hash
135
- end
136
-
137
- # Builds the object from hash
138
- # @param [Hash] attributes Model attributes in the form of hash
139
- # @return [Object] Returns the model itself
140
- def self.build_from_hash(attributes)
141
- return nil unless attributes.is_a?(Hash)
142
- attributes = attributes.transform_keys(&:to_sym)
143
- transformed_hash = {}
144
- openapi_types.each_pair do |key, type|
145
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
- transformed_hash["#{key}"] = nil
147
- elsif type =~ /\AArray<(.*)>/i
148
- # check to ensure the input is an array given that the attribute
149
- # is documented as an array but the input is not
150
- if attributes[attribute_map[key]].is_a?(Array)
151
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
- end
153
- elsif !attributes[attribute_map[key]].nil?
154
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
155
- end
156
- end
157
- new(transformed_hash)
158
- end
159
-
160
- # Returns the object in the form of hash
161
- # @return [Hash] Returns the object in the form of hash
162
- def to_hash
163
- hash = {}
164
- self.class.attribute_map.each_pair do |attr, param|
165
- value = self.send(attr)
166
- if value.nil?
167
- is_nullable = self.class.openapi_nullable.include?(attr)
168
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
- end
170
-
171
- hash[param] = _to_hash(value)
172
- end
173
- hash
174
- end
175
-
176
- end
177
-
178
- end
@@ -1,178 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module WebScrapingAI
17
- class Error < ApiModelBase
18
- # Error description
19
- attr_accessor :message
20
-
21
- # Target page response HTTP status code (403, 500, etc)
22
- attr_accessor :status_code
23
-
24
- # Target page response HTTP status message
25
- attr_accessor :status_message
26
-
27
- # Target page response body
28
- attr_accessor :body
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'message' => :'message',
34
- :'status_code' => :'status_code',
35
- :'status_message' => :'status_message',
36
- :'body' => :'body'
37
- }
38
- end
39
-
40
- # Returns attribute mapping this model knows about
41
- def self.acceptable_attribute_map
42
- attribute_map
43
- end
44
-
45
- # Returns all the JSON keys this model knows about
46
- def self.acceptable_attributes
47
- acceptable_attribute_map.values
48
- end
49
-
50
- # Attribute type mapping.
51
- def self.openapi_types
52
- {
53
- :'message' => :'String',
54
- :'status_code' => :'Integer',
55
- :'status_message' => :'String',
56
- :'body' => :'String'
57
- }
58
- end
59
-
60
- # List of attributes with nullable: true
61
- def self.openapi_nullable
62
- Set.new([
63
- ])
64
- end
65
-
66
- # Initializes the object
67
- # @param [Hash] attributes Model attributes in the form of hash
68
- def initialize(attributes = {})
69
- if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `WebScrapingAI::Error` initialize method"
71
- end
72
-
73
- # check to see if the attribute exists and convert string to symbol for hash key
74
- acceptable_attribute_map = self.class.acceptable_attribute_map
75
- attributes = attributes.each_with_object({}) { |(k, v), h|
76
- if (!acceptable_attribute_map.key?(k.to_sym))
77
- fail ArgumentError, "`#{k}` is not a valid attribute in `WebScrapingAI::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
- end
79
- h[k.to_sym] = v
80
- }
81
-
82
- if attributes.key?(:'message')
83
- self.message = attributes[:'message']
84
- end
85
-
86
- if attributes.key?(:'status_code')
87
- self.status_code = attributes[:'status_code']
88
- end
89
-
90
- if attributes.key?(:'status_message')
91
- self.status_message = attributes[:'status_message']
92
- end
93
-
94
- if attributes.key?(:'body')
95
- self.body = attributes[:'body']
96
- end
97
- end
98
-
99
- # Show invalid properties with the reasons. Usually used together with valid?
100
- # @return Array for valid properties with the reasons
101
- def list_invalid_properties
102
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
- invalid_properties = Array.new
104
- invalid_properties
105
- end
106
-
107
- # Check to see if the all the properties in the model are valid
108
- # @return true if the model is valid
109
- def valid?
110
- warn '[DEPRECATED] the `valid?` method is obsolete'
111
- true
112
- end
113
-
114
- # Checks equality by comparing each attribute.
115
- # @param [Object] Object to be compared
116
- def ==(o)
117
- return true if self.equal?(o)
118
- self.class == o.class &&
119
- message == o.message &&
120
- status_code == o.status_code &&
121
- status_message == o.status_message &&
122
- body == o.body
123
- end
124
-
125
- # @see the `==` method
126
- # @param [Object] Object to be compared
127
- def eql?(o)
128
- self == o
129
- end
130
-
131
- # Calculates hash code according to all attributes.
132
- # @return [Integer] Hash code
133
- def hash
134
- [message, status_code, status_message, body].hash
135
- end
136
-
137
- # Builds the object from hash
138
- # @param [Hash] attributes Model attributes in the form of hash
139
- # @return [Object] Returns the model itself
140
- def self.build_from_hash(attributes)
141
- return nil unless attributes.is_a?(Hash)
142
- attributes = attributes.transform_keys(&:to_sym)
143
- transformed_hash = {}
144
- openapi_types.each_pair do |key, type|
145
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
- transformed_hash["#{key}"] = nil
147
- elsif type =~ /\AArray<(.*)>/i
148
- # check to ensure the input is an array given that the attribute
149
- # is documented as an array but the input is not
150
- if attributes[attribute_map[key]].is_a?(Array)
151
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
- end
153
- elsif !attributes[attribute_map[key]].nil?
154
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
155
- end
156
- end
157
- new(transformed_hash)
158
- end
159
-
160
- # Returns the object in the form of hash
161
- # @return [Hash] Returns the object in the form of hash
162
- def to_hash
163
- hash = {}
164
- self.class.attribute_map.each_pair do |attr, param|
165
- value = self.send(attr)
166
- if value.nil?
167
- is_nullable = self.class.openapi_nullable.include?(attr)
168
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
169
- end
170
-
171
- hash[param] = _to_hash(value)
172
- end
173
- hash
174
- end
175
-
176
- end
177
-
178
- end
@@ -1,46 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for WebScrapingAI::AccountApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'AccountApi' do
20
- before do
21
- # run before each test
22
- @api_instance = WebScrapingAI::AccountApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of AccountApi' do
30
- it 'should create an instance of AccountApi' do
31
- expect(@api_instance).to be_instance_of(WebScrapingAI::AccountApi)
32
- end
33
- end
34
-
35
- # unit tests for account
36
- # Information about your account calls quota
37
- # Returns information about your account, including the remaining API credits quota, the next billing cycle start time, and the remaining concurrent requests. The response is in JSON format.
38
- # @param [Hash] opts the optional parameters
39
- # @return [Account]
40
- describe 'account test' do
41
- it 'should work' do
42
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
- end
44
- end
45
-
46
- end
@@ -1,86 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for WebScrapingAI::AIApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'AIApi' do
20
- before do
21
- # run before each test
22
- @api_instance = WebScrapingAI::AIApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of AIApi' do
30
- it 'should create an instance of AIApi' do
31
- expect(@api_instance).to be_instance_of(WebScrapingAI::AIApi)
32
- end
33
- end
34
-
35
- # unit tests for get_fields
36
- # Extract structured data fields from a web page
37
- # Returns structured data fields extracted from the webpage using an LLM model. Proxies and Chromium JavaScript rendering are used for page retrieval and processing.
38
- # @param url URL of the target page.
39
- # @param fields Object describing fields to extract from the page and their descriptions
40
- # @param [Hash] opts the optional parameters
41
- # @option opts [Hash<String, String>] :headers HTTP headers to pass to the target page. Can be specified either via a nested query parameter (...&amp;headers[One]&#x3D;value1&amp;headers&#x3D;[Another]&#x3D;value2) or as a JSON encoded object (...&amp;headers&#x3D;{\&quot;One\&quot;: \&quot;value1\&quot;, \&quot;Another\&quot;: \&quot;value2\&quot;}).
42
- # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000).
43
- # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default).
44
- # @option opts [Integer] :js_timeout Maximum JavaScript rendering time in ms. Increase it in case if you see a loading indicator instead of data on the target page.
45
- # @option opts [String] :wait_for CSS selector to wait for before returning the page content. Useful for pages with dynamic content loading. Overrides js_timeout.
46
- # @option opts [String] :proxy Type of proxy. Use &#x60;residential&#x60; if your site restricts traffic from datacenters, or &#x60;stealth&#x60; for the most heavily protected sites with advanced anti-bot detection (&#x60;datacenter&#x60; by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details.
47
- # @option opts [String] :country Country of the proxy to use (US by default).
48
- # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \&quot;http://user:password@host:port\&quot; format (&lt;a target&#x3D;\&quot;_blank\&quot; href&#x3D;\&quot;https://webscraping.ai/proxies/smartproxy\&quot;&gt;Smartproxy&lt;/a&gt; for example).
49
- # @option opts [String] :device Type of device emulation.
50
- # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default).
51
- # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default).
52
- # @option opts [String] :js_script Custom JavaScript code to execute on the target page.
53
- # @return [Hash<String, String>]
54
- describe 'get_fields test' do
55
- it 'should work' do
56
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
57
- end
58
- end
59
-
60
- # unit tests for get_question
61
- # Get an answer to a question about a given web page
62
- # Returns the answer in plain text. Proxies and Chromium JavaScript rendering are used for page retrieval and processing, then the answer is extracted using an LLM model.
63
- # @param url URL of the target page.
64
- # @param [Hash] opts the optional parameters
65
- # @option opts [String] :question Question or instructions to ask the LLM model about the target page.
66
- # @option opts [Hash<String, String>] :headers HTTP headers to pass to the target page. Can be specified either via a nested query parameter (...&amp;headers[One]&#x3D;value1&amp;headers&#x3D;[Another]&#x3D;value2) or as a JSON encoded object (...&amp;headers&#x3D;{\&quot;One\&quot;: \&quot;value1\&quot;, \&quot;Another\&quot;: \&quot;value2\&quot;}).
67
- # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000).
68
- # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default).
69
- # @option opts [Integer] :js_timeout Maximum JavaScript rendering time in ms. Increase it in case if you see a loading indicator instead of data on the target page.
70
- # @option opts [String] :wait_for CSS selector to wait for before returning the page content. Useful for pages with dynamic content loading. Overrides js_timeout.
71
- # @option opts [String] :proxy Type of proxy. Use &#x60;residential&#x60; if your site restricts traffic from datacenters, or &#x60;stealth&#x60; for the most heavily protected sites with advanced anti-bot detection (&#x60;datacenter&#x60; by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details.
72
- # @option opts [String] :country Country of the proxy to use (US by default).
73
- # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \&quot;http://user:password@host:port\&quot; format (&lt;a target&#x3D;\&quot;_blank\&quot; href&#x3D;\&quot;https://webscraping.ai/proxies/smartproxy\&quot;&gt;Smartproxy&lt;/a&gt; for example).
74
- # @option opts [String] :device Type of device emulation.
75
- # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default).
76
- # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default).
77
- # @option opts [String] :js_script Custom JavaScript code to execute on the target page.
78
- # @option opts [String] :format Format of the response (text by default). \&quot;json\&quot; will return a JSON object with the response, \&quot;text\&quot; will return a plain text/HTML response.
79
- # @return [String]
80
- describe 'get_question test' do
81
- it 'should work' do
82
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
83
- end
84
- end
85
-
86
- end
@@ -1,61 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for WebScrapingAI::HTMLApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'HTMLApi' do
20
- before do
21
- # run before each test
22
- @api_instance = WebScrapingAI::HTMLApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of HTMLApi' do
30
- it 'should create an instance of HTMLApi' do
31
- expect(@api_instance).to be_instance_of(WebScrapingAI::HTMLApi)
32
- end
33
- end
34
-
35
- # unit tests for get_html
36
- # Page HTML by URL
37
- # Returns the full HTML content of a webpage specified by the URL. The response is in plain text. Proxies and Chromium JavaScript rendering are used for page retrieval and processing.
38
- # @param url URL of the target page.
39
- # @param [Hash] opts the optional parameters
40
- # @option opts [Hash<String, String>] :headers HTTP headers to pass to the target page. Can be specified either via a nested query parameter (...&amp;headers[One]&#x3D;value1&amp;headers&#x3D;[Another]&#x3D;value2) or as a JSON encoded object (...&amp;headers&#x3D;{\&quot;One\&quot;: \&quot;value1\&quot;, \&quot;Another\&quot;: \&quot;value2\&quot;}).
41
- # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000).
42
- # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default).
43
- # @option opts [Integer] :js_timeout Maximum JavaScript rendering time in ms. Increase it in case if you see a loading indicator instead of data on the target page.
44
- # @option opts [String] :wait_for CSS selector to wait for before returning the page content. Useful for pages with dynamic content loading. Overrides js_timeout.
45
- # @option opts [String] :proxy Type of proxy. Use &#x60;residential&#x60; if your site restricts traffic from datacenters, or &#x60;stealth&#x60; for the most heavily protected sites with advanced anti-bot detection (&#x60;datacenter&#x60; by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details.
46
- # @option opts [String] :country Country of the proxy to use (US by default).
47
- # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \&quot;http://user:password@host:port\&quot; format (&lt;a target&#x3D;\&quot;_blank\&quot; href&#x3D;\&quot;https://webscraping.ai/proxies/smartproxy\&quot;&gt;Smartproxy&lt;/a&gt; for example).
48
- # @option opts [String] :device Type of device emulation.
49
- # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default).
50
- # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default).
51
- # @option opts [String] :js_script Custom JavaScript code to execute on the target page.
52
- # @option opts [Boolean] :return_script_result Return result of the custom JavaScript code (js_script parameter) execution on the target page (false by default, page HTML will be returned).
53
- # @option opts [String] :format Format of the response (text by default). \&quot;json\&quot; will return a JSON object with the response, \&quot;text\&quot; will return a plain text/HTML response.
54
- # @return [String]
55
- describe 'get_html test' do
56
- it 'should work' do
57
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
58
- end
59
- end
60
-
61
- end
@@ -1,86 +0,0 @@
1
- =begin
2
- #WebScraping.AI
3
-
4
- #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
-
6
- The version of the OpenAPI document: 3.2.1
7
- Contact: support@webscraping.ai
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.22.0
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for WebScrapingAI::SelectedHTMLApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'SelectedHTMLApi' do
20
- before do
21
- # run before each test
22
- @api_instance = WebScrapingAI::SelectedHTMLApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of SelectedHTMLApi' do
30
- it 'should create an instance of SelectedHTMLApi' do
31
- expect(@api_instance).to be_instance_of(WebScrapingAI::SelectedHTMLApi)
32
- end
33
- end
34
-
35
- # unit tests for get_selected
36
- # HTML of a selected page area by URL and CSS selector
37
- # Returns HTML of a selected page area by URL and CSS selector. Useful if you don&#39;t want to do the HTML parsing on your side.
38
- # @param url URL of the target page.
39
- # @param [Hash] opts the optional parameters
40
- # @option opts [String] :selector CSS selector (null by default, returns whole page HTML)
41
- # @option opts [Hash<String, String>] :headers HTTP headers to pass to the target page. Can be specified either via a nested query parameter (...&amp;headers[One]&#x3D;value1&amp;headers&#x3D;[Another]&#x3D;value2) or as a JSON encoded object (...&amp;headers&#x3D;{\&quot;One\&quot;: \&quot;value1\&quot;, \&quot;Another\&quot;: \&quot;value2\&quot;}).
42
- # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000).
43
- # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default).
44
- # @option opts [Integer] :js_timeout Maximum JavaScript rendering time in ms. Increase it in case if you see a loading indicator instead of data on the target page.
45
- # @option opts [String] :wait_for CSS selector to wait for before returning the page content. Useful for pages with dynamic content loading. Overrides js_timeout.
46
- # @option opts [String] :proxy Type of proxy. Use &#x60;residential&#x60; if your site restricts traffic from datacenters, or &#x60;stealth&#x60; for the most heavily protected sites with advanced anti-bot detection (&#x60;datacenter&#x60; by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details.
47
- # @option opts [String] :country Country of the proxy to use (US by default).
48
- # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \&quot;http://user:password@host:port\&quot; format (&lt;a target&#x3D;\&quot;_blank\&quot; href&#x3D;\&quot;https://webscraping.ai/proxies/smartproxy\&quot;&gt;Smartproxy&lt;/a&gt; for example).
49
- # @option opts [String] :device Type of device emulation.
50
- # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default).
51
- # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default).
52
- # @option opts [String] :js_script Custom JavaScript code to execute on the target page.
53
- # @option opts [String] :format Format of the response (text by default). \&quot;json\&quot; will return a JSON object with the response, \&quot;text\&quot; will return a plain text/HTML response.
54
- # @return [String]
55
- describe 'get_selected test' do
56
- it 'should work' do
57
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
58
- end
59
- end
60
-
61
- # unit tests for get_selected_multiple
62
- # HTML of multiple page areas by URL and CSS selectors
63
- # Returns HTML of multiple page areas by URL and CSS selectors. Useful if you don&#39;t want to do the HTML parsing on your side.
64
- # @param url URL of the target page.
65
- # @param [Hash] opts the optional parameters
66
- # @option opts [Array<String>] :selectors Multiple CSS selectors (null by default, returns whole page HTML)
67
- # @option opts [Hash<String, String>] :headers HTTP headers to pass to the target page. Can be specified either via a nested query parameter (...&amp;headers[One]&#x3D;value1&amp;headers&#x3D;[Another]&#x3D;value2) or as a JSON encoded object (...&amp;headers&#x3D;{\&quot;One\&quot;: \&quot;value1\&quot;, \&quot;Another\&quot;: \&quot;value2\&quot;}).
68
- # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000).
69
- # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default).
70
- # @option opts [Integer] :js_timeout Maximum JavaScript rendering time in ms. Increase it in case if you see a loading indicator instead of data on the target page.
71
- # @option opts [String] :wait_for CSS selector to wait for before returning the page content. Useful for pages with dynamic content loading. Overrides js_timeout.
72
- # @option opts [String] :proxy Type of proxy. Use &#x60;residential&#x60; if your site restricts traffic from datacenters, or &#x60;stealth&#x60; for the most heavily protected sites with advanced anti-bot detection (&#x60;datacenter&#x60; by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details.
73
- # @option opts [String] :country Country of the proxy to use (US by default).
74
- # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \&quot;http://user:password@host:port\&quot; format (&lt;a target&#x3D;\&quot;_blank\&quot; href&#x3D;\&quot;https://webscraping.ai/proxies/smartproxy\&quot;&gt;Smartproxy&lt;/a&gt; for example).
75
- # @option opts [String] :device Type of device emulation.
76
- # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default).
77
- # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default).
78
- # @option opts [String] :js_script Custom JavaScript code to execute on the target page.
79
- # @return [Array<String>]
80
- describe 'get_selected_multiple test' do
81
- it 'should work' do
82
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
83
- end
84
- end
85
-
86
- end