webscraping_ai 3.1.3 → 3.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.
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -20,7 +20,7 @@ module WebScrapingAI
20
20
  @api_client = api_client
21
21
  end
22
22
  # Page text by URL
23
- # Returns the visible text content of a webpage specified by the URL. Can be used to feed data to GPT or other LLM models. The response can be in plain text, JSON, or XML format based on the text_format parameter. Proxies and Chromium JavaScript rendering are used for page retrieval and processing. Returns JSON on error.
23
+ # Returns the visible text content of a webpage specified by the URL. Can be used to feed data to LLM models. The response can be in plain text, JSON, or XML format based on the text_format parameter. Proxies and Chromium JavaScript rendering are used for page retrieval and processing. Returns JSON on error.
24
24
  # @param url [String] URL of the target page.
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @option opts [String] :text_format Format of the text response (plain by default). \"plain\" will return only the page body text. \"json\" and \"xml\" will return a json/xml with \"title\", \"description\" and \"content\" keys. (default to 'plain')
@@ -29,8 +29,10 @@ module WebScrapingAI
29
29
  # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000). (default to 10000)
30
30
  # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default). (default to true)
31
31
  # @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. (default to 2000)
32
- # @option opts [String] :proxy Type of proxy, use residential proxies if your site restricts traffic from datacenters (datacenter by default). Note that residential proxy requests are more expensive than datacenter, see the pricing page for details. (default to 'datacenter')
33
- # @option opts [String] :country Country of the proxy to use (US by default). Only available on Startup and Custom plans. (default to 'us')
32
+ # @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.
33
+ # @option opts [String] :proxy Type of proxy. Use `residential` if your site restricts traffic from datacenters, or `stealth` for the most heavily protected sites with advanced anti-bot detection (`datacenter` by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details. (default to 'datacenter')
34
+ # @option opts [String] :country Country of the proxy to use (US by default). (default to 'us')
35
+ # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \"http://user:password@host:port\" format (<a target=\"_blank\" href=\"https://webscraping.ai/proxies/smartproxy\">Smartproxy</a> for example).
34
36
  # @option opts [String] :device Type of device emulation. (default to 'desktop')
35
37
  # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default). (default to false)
36
38
  # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default). (default to false)
@@ -42,7 +44,7 @@ module WebScrapingAI
42
44
  end
43
45
 
44
46
  # Page text by URL
45
- # Returns the visible text content of a webpage specified by the URL. Can be used to feed data to GPT or other LLM models. The response can be in plain text, JSON, or XML format based on the text_format parameter. Proxies and Chromium JavaScript rendering are used for page retrieval and processing. Returns JSON on error.
47
+ # Returns the visible text content of a webpage specified by the URL. Can be used to feed data to LLM models. The response can be in plain text, JSON, or XML format based on the text_format parameter. Proxies and Chromium JavaScript rendering are used for page retrieval and processing. Returns JSON on error.
46
48
  # @param url [String] URL of the target page.
47
49
  # @param [Hash] opts the optional parameters
48
50
  # @option opts [String] :text_format Format of the text response (plain by default). \"plain\" will return only the page body text. \"json\" and \"xml\" will return a json/xml with \"title\", \"description\" and \"content\" keys. (default to 'plain')
@@ -51,8 +53,10 @@ module WebScrapingAI
51
53
  # @option opts [Integer] :timeout Maximum web page retrieval time in ms. Increase it in case of timeout errors (10000 by default, maximum is 30000). (default to 10000)
52
54
  # @option opts [Boolean] :js Execute on-page JavaScript using a headless browser (true by default). (default to true)
53
55
  # @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. (default to 2000)
54
- # @option opts [String] :proxy Type of proxy, use residential proxies if your site restricts traffic from datacenters (datacenter by default). Note that residential proxy requests are more expensive than datacenter, see the pricing page for details. (default to 'datacenter')
55
- # @option opts [String] :country Country of the proxy to use (US by default). Only available on Startup and Custom plans. (default to 'us')
56
+ # @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.
57
+ # @option opts [String] :proxy Type of proxy. Use `residential` if your site restricts traffic from datacenters, or `stealth` for the most heavily protected sites with advanced anti-bot detection (`datacenter` by default). Residential and stealth proxy requests are more expensive than datacenter, see the pricing page for details. (default to 'datacenter')
58
+ # @option opts [String] :country Country of the proxy to use (US by default). (default to 'us')
59
+ # @option opts [String] :custom_proxy Your own proxy URL to use instead of our built-in proxy pool in \"http://user:password@host:port\" format (<a target=\"_blank\" href=\"https://webscraping.ai/proxies/smartproxy\">Smartproxy</a> for example).
56
60
  # @option opts [String] :device Type of device emulation. (default to 'desktop')
57
61
  # @option opts [Boolean] :error_on_404 Return error on 404 HTTP status on the target page (false by default). (default to false)
58
62
  # @option opts [Boolean] :error_on_redirect Return error on redirect on the target page (false by default). (default to false)
@@ -86,11 +90,11 @@ module WebScrapingAI
86
90
  fail ArgumentError, 'invalid value for "opts[:"js_timeout"]" when calling TextApi.get_text, must be greater than or equal to 1.'
87
91
  end
88
92
 
89
- allowable_values = ["datacenter", "residential"]
93
+ allowable_values = ["datacenter", "residential", "stealth"]
90
94
  if @api_client.config.client_side_validation && opts[:'proxy'] && !allowable_values.include?(opts[:'proxy'])
91
95
  fail ArgumentError, "invalid value for \"proxy\", must be one of #{allowable_values}"
92
96
  end
93
- allowable_values = ["us", "gb", "de", "it", "fr", "ca", "es", "ru", "jp", "kr"]
97
+ allowable_values = ["us", "gb", "de", "it", "fr", "ca", "es", "ru", "jp", "kr", "in", "hk", "tr"]
94
98
  if @api_client.config.client_side_validation && opts[:'country'] && !allowable_values.include?(opts[:'country'])
95
99
  fail ArgumentError, "invalid value for \"country\", must be one of #{allowable_values}"
96
100
  end
@@ -110,8 +114,10 @@ module WebScrapingAI
110
114
  query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
111
115
  query_params[:'js'] = opts[:'js'] if !opts[:'js'].nil?
112
116
  query_params[:'js_timeout'] = opts[:'js_timeout'] if !opts[:'js_timeout'].nil?
117
+ query_params[:'wait_for'] = opts[:'wait_for'] if !opts[:'wait_for'].nil?
113
118
  query_params[:'proxy'] = opts[:'proxy'] if !opts[:'proxy'].nil?
114
119
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
120
+ query_params[:'custom_proxy'] = opts[:'custom_proxy'] if !opts[:'custom_proxy'].nil?
115
121
  query_params[:'device'] = opts[:'device'] if !opts[:'device'].nil?
116
122
  query_params[:'error_on_404'] = opts[:'error_on_404'] if !opts[:'error_on_404'].nil?
117
123
  query_params[:'error_on_redirect'] = opts[:'error_on_redirect'] if !opts[:'error_on_redirect'].nil?
@@ -120,7 +126,7 @@ module WebScrapingAI
120
126
  # header parameters
121
127
  header_params = opts[:header_params] || {}
122
128
  # HTTP header 'Accept' (if needed)
123
- header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/html', 'text/xml'])
129
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/html', 'text/xml']) unless header_params['Accept']
124
130
 
125
131
  # form parameters
126
132
  form_params = opts[:form_params] || {}
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -49,7 +49,8 @@ module WebScrapingAI
49
49
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
50
50
  def call_api(http_method, path, opts = {})
51
51
  request = build_request(http_method, path, opts)
52
- tempfile = download_file(request) if opts[:return_type] == 'File'
52
+ tempfile = nil
53
+ (download_file(request) { tempfile = _1 }) if opts[:return_type] == 'File'
53
54
  response = request.run
54
55
 
55
56
  if @config.debugging
@@ -188,19 +189,17 @@ module WebScrapingAI
188
189
  chunk.force_encoding(encoding)
189
190
  tempfile.write(chunk)
190
191
  end
191
- # run the request to ensure the tempfile is created successfully before returning it
192
- request.run
193
- if tempfile
192
+ request.on_complete do
193
+ if !tempfile
194
+ fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
195
+ end
194
196
  tempfile.close
195
197
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
196
198
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
197
199
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
198
200
  "explicitly with `tempfile.delete`"
199
- else
200
- fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
201
+ yield tempfile if block_given?
201
202
  end
202
-
203
- tempfile
204
203
  end
205
204
 
206
205
  # Check if the given MIME is a JSON MIME.
@@ -212,7 +211,7 @@ module WebScrapingAI
212
211
  # @param [String] mime MIME
213
212
  # @return [Boolean] True if the MIME is application/json
214
213
  def json_mime?(mime)
215
- (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
214
+ (mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
216
215
  end
217
216
 
218
217
  # Deserialize the response to the given return type.
@@ -279,9 +278,13 @@ module WebScrapingAI
279
278
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
280
279
  end
281
280
  else
282
- # models (e.g. Pet) or oneOf
281
+ # models (e.g. Pet) or oneOf/anyOf
283
282
  klass = WebScrapingAI.const_get(return_type)
284
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
283
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
284
+ klass.build(data)
285
+ else
286
+ klass.build_from_hash(data)
287
+ end
285
288
  end
286
289
  end
287
290
 
@@ -291,7 +294,7 @@ module WebScrapingAI
291
294
  # @param [String] filename the filename to be sanitized
292
295
  # @return [String] the sanitized filename
293
296
  def sanitize_filename(filename)
294
- filename.gsub(/.*[\/\\]/, '')
297
+ filename.split(/[\/\\]/).last
295
298
  end
296
299
 
297
300
  def build_request_url(path, opts = {})
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
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
+ module WebScrapingAI
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = WebScrapingAI.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -79,6 +79,14 @@ module WebScrapingAI
79
79
  # @return [true, false]
80
80
  attr_accessor :debugging
81
81
 
82
+ # Set this to ignore operation servers for the API client. This is useful when you need to
83
+ # send requests to a different server than the one specified in the OpenAPI document.
84
+ # Will default to the base url defined in the spec but can be overridden by setting
85
+ # `scheme`, `host`, `base_path` directly.
86
+ # Default to false.
87
+ # @return [true, false]
88
+ attr_accessor :ignore_operation_servers
89
+
82
90
  # Defines the logger used for debugging.
83
91
  # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
92
  #
@@ -166,6 +174,7 @@ module WebScrapingAI
166
174
  @timeout = 0
167
175
  @params_encoding = nil
168
176
  @debugging = false
177
+ @ignore_operation_servers = false
169
178
  @inject_format = false
170
179
  @force_ending_format = false
171
180
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
@@ -200,6 +209,7 @@ module WebScrapingAI
200
209
 
201
210
  # Returns base URL for specified operation based on server settings
202
211
  def base_url(operation = nil)
212
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
203
213
  if operation_server_settings.key?(operation) then
204
214
  index = server_operation_index.fetch(operation, server_index)
205
215
  server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,10 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module WebScrapingAI
17
- class Account
17
+ class Account < ApiModelBase
18
+ # Your account email
19
+ attr_accessor :email
20
+
18
21
  # Remaining API credits quota
19
22
  attr_accessor :remaining_api_calls
20
23
 
@@ -27,20 +30,27 @@ module WebScrapingAI
27
30
  # Attribute mapping from ruby-style variable name to JSON key.
28
31
  def self.attribute_map
29
32
  {
33
+ :'email' => :'email',
30
34
  :'remaining_api_calls' => :'remaining_api_calls',
31
35
  :'resets_at' => :'resets_at',
32
36
  :'remaining_concurrency' => :'remaining_concurrency'
33
37
  }
34
38
  end
35
39
 
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
36
45
  # Returns all the JSON keys this model knows about
37
46
  def self.acceptable_attributes
38
- attribute_map.values
47
+ acceptable_attribute_map.values
39
48
  end
40
49
 
41
50
  # Attribute type mapping.
42
51
  def self.openapi_types
43
52
  {
53
+ :'email' => :'String',
44
54
  :'remaining_api_calls' => :'Integer',
45
55
  :'resets_at' => :'Integer',
46
56
  :'remaining_concurrency' => :'Integer'
@@ -61,13 +71,18 @@ module WebScrapingAI
61
71
  end
62
72
 
63
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
64
75
  attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `WebScrapingAI::Account`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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
67
78
  end
68
79
  h[k.to_sym] = v
69
80
  }
70
81
 
82
+ if attributes.key?(:'email')
83
+ self.email = attributes[:'email']
84
+ end
85
+
71
86
  if attributes.key?(:'remaining_api_calls')
72
87
  self.remaining_api_calls = attributes[:'remaining_api_calls']
73
88
  end
@@ -101,6 +116,7 @@ module WebScrapingAI
101
116
  def ==(o)
102
117
  return true if self.equal?(o)
103
118
  self.class == o.class &&
119
+ email == o.email &&
104
120
  remaining_api_calls == o.remaining_api_calls &&
105
121
  resets_at == o.resets_at &&
106
122
  remaining_concurrency == o.remaining_concurrency
@@ -115,7 +131,7 @@ module WebScrapingAI
115
131
  # Calculates hash code according to all attributes.
116
132
  # @return [Integer] Hash code
117
133
  def hash
118
- [remaining_api_calls, resets_at, remaining_concurrency].hash
134
+ [email, remaining_api_calls, resets_at, remaining_concurrency].hash
119
135
  end
120
136
 
121
137
  # Builds the object from hash
@@ -141,61 +157,6 @@ module WebScrapingAI
141
157
  new(transformed_hash)
142
158
  end
143
159
 
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def self._deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
- when :Object
167
- # generic object (usually a Hash), return directly
168
- value
169
- when /\AArray<(?<inner_type>.+)>\z/
170
- inner_type = Regexp.last_match[:inner_type]
171
- value.map { |v| _deserialize(inner_type, v) }
172
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
- k_type = Regexp.last_match[:k_type]
174
- v_type = Regexp.last_match[:v_type]
175
- {}.tap do |hash|
176
- value.each do |k, v|
177
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
- end
179
- end
180
- else # model
181
- # models (e.g. Pet) or oneOf
182
- klass = WebScrapingAI.const_get(type)
183
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
- end
185
- end
186
-
187
- # Returns the string representation of the object
188
- # @return [String] String presentation of the object
189
- def to_s
190
- to_hash.to_s
191
- end
192
-
193
- # to_body is an alias to to_hash (backward compatibility)
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_body
196
- to_hash
197
- end
198
-
199
160
  # Returns the object in the form of hash
200
161
  # @return [Hash] Returns the object in the form of hash
201
162
  def to_hash
@@ -212,24 +173,6 @@ module WebScrapingAI
212
173
  hash
213
174
  end
214
175
 
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
232
-
233
176
  end
234
177
 
235
178
  end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module WebScrapingAI
17
- class Error
17
+ class Error < ApiModelBase
18
18
  # Error description
19
19
  attr_accessor :message
20
20
 
@@ -37,9 +37,14 @@ module WebScrapingAI
37
37
  }
38
38
  end
39
39
 
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
40
45
  # Returns all the JSON keys this model knows about
41
46
  def self.acceptable_attributes
42
- attribute_map.values
47
+ acceptable_attribute_map.values
43
48
  end
44
49
 
45
50
  # Attribute type mapping.
@@ -66,9 +71,10 @@ module WebScrapingAI
66
71
  end
67
72
 
68
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
69
75
  attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `WebScrapingAI::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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
72
78
  end
73
79
  h[k.to_sym] = v
74
80
  }
@@ -151,61 +157,6 @@ module WebScrapingAI
151
157
  new(transformed_hash)
152
158
  end
153
159
 
154
- # Deserializes the data based on type
155
- # @param string type Data type
156
- # @param string value Value to be deserialized
157
- # @return [Object] Deserialized data
158
- def self._deserialize(type, value)
159
- case type.to_sym
160
- when :Time
161
- Time.parse(value)
162
- when :Date
163
- Date.parse(value)
164
- when :String
165
- value.to_s
166
- when :Integer
167
- value.to_i
168
- when :Float
169
- value.to_f
170
- when :Boolean
171
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
- true
173
- else
174
- false
175
- end
176
- when :Object
177
- # generic object (usually a Hash), return directly
178
- value
179
- when /\AArray<(?<inner_type>.+)>\z/
180
- inner_type = Regexp.last_match[:inner_type]
181
- value.map { |v| _deserialize(inner_type, v) }
182
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
- k_type = Regexp.last_match[:k_type]
184
- v_type = Regexp.last_match[:v_type]
185
- {}.tap do |hash|
186
- value.each do |k, v|
187
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
- end
189
- end
190
- else # model
191
- # models (e.g. Pet) or oneOf
192
- klass = WebScrapingAI.const_get(type)
193
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
- end
195
- end
196
-
197
- # Returns the string representation of the object
198
- # @return [String] String presentation of the object
199
- def to_s
200
- to_hash.to_s
201
- end
202
-
203
- # to_body is an alias to to_hash (backward compatibility)
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_body
206
- to_hash
207
- end
208
-
209
160
  # Returns the object in the form of hash
210
161
  # @return [Hash] Returns the object in the form of hash
211
162
  def to_hash
@@ -222,24 +173,6 @@ module WebScrapingAI
222
173
  hash
223
174
  end
224
175
 
225
- # Outputs non-array value in the form of hash
226
- # For object, use to_hash. Otherwise, just return the value
227
- # @param [Object] value Any valid value
228
- # @return [Hash] Returns the value in the form of hash
229
- def _to_hash(value)
230
- if value.is_a?(Array)
231
- value.compact.map { |v| _to_hash(v) }
232
- elsif value.is_a?(Hash)
233
- {}.tap do |hash|
234
- value.each { |k, v| hash[k] = _to_hash(v) }
235
- end
236
- elsif value.respond_to? :to_hash
237
- value.to_hash
238
- else
239
- value
240
- end
241
- end
242
-
243
176
  end
244
177
 
245
178
  end
@@ -1,15 +1,15 @@
1
1
  =begin
2
2
  #WebScraping.AI
3
3
 
4
- #WebScraping.AI scraping API provides GPT-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
4
+ #WebScraping.AI scraping API provides LLM-powered tools with Chromium JavaScript rendering, rotating proxies, and built-in HTML parsing.
5
5
 
6
- The version of the OpenAPI document: 3.1.3
6
+ The version of the OpenAPI document: 3.2.1
7
7
  Contact: support@webscraping.ai
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.2.0
9
+ Generator version: 7.22.0
10
10
 
11
11
  =end
12
12
 
13
13
  module WebScrapingAI
14
- VERSION = '3.1.3'
14
+ VERSION = '3.2.1'
15
15
  end