outscraper 0.3.4 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e490638335315130985cc5b8f5c2c268b72a56142fb4c06383dabff1ecfd3ece
4
- data.tar.gz: 2ef885848538c535630b6ded859f0fa8657fd36455e45fe07a7da93bc5180ad9
3
+ metadata.gz: 9476b68f4bd7fc5b7af263cc5cb28b5e753960d760c44d1e697681123aee6236
4
+ data.tar.gz: 298ec43dbdec09108bbf6e98660b0e1150dce799d3408740a2c6d8fdbfd33c43
5
5
  SHA512:
6
- metadata.gz: 732b1c087ccf83a52193fe54afaf03a0fa31d642dfab11c03c587a04b427df9df2962e0b259690e7e49c3a2de77d36901fc89f9e60953d17aadd836300609780
7
- data.tar.gz: 8a8c95af2d738edc5aba671ee0f1005302c6674a81ca5c7c9830c4f8f6b0b4cc53823da594af1df51e6da175b3d81d798ab779c4dc1aa6cb65ea382910e0b779
6
+ metadata.gz: fb819008c8e1a0e634c4a73779842810153156b7c22fc2ce94954e8a030ee363d8dc57127a0db61e190b40dab50d349a93c852d5faf1ebe1cefeba7b7674dde0
7
+ data.tar.gz: 2b8beb1a3fdf33a45d0bfc20f293516b535106dfb723f5499f831fea583e5f5788423033939665ce109536ac804ecb2b47dd17f016265f860c45efdb197a7fe2
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outscraper
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
data/lib/outscraper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "httparty"
4
+ require "cgi"
5
+ require "json"
4
6
 
5
7
  require_relative "outscraper/version"
6
8
 
@@ -391,5 +393,89 @@ module Outscraper
391
393
  webhook: webhook
392
394
  }).parsed_response['data']
393
395
  end
396
+
397
+ def postAPIRequest(path, parameters = {})
398
+ payload = parameters || {}
399
+
400
+ response = self.class.post(
401
+ path,
402
+ headers: { 'Content-Type' => 'application/json' },
403
+ body: payload.to_json
404
+ ).parsed_response
405
+
406
+ response.is_a?(Hash) && response.key?('data') ? response['data'] : response
407
+ end
408
+
409
+ def businessesSearch(
410
+ filters: {},
411
+ limit: 10,
412
+ include_total: false,
413
+ cursor: nil,
414
+ fields: nil,
415
+ async_request: false,
416
+ ui: false,
417
+ webhook: nil
418
+ )
419
+ payload = {
420
+ filters: (filters || {}),
421
+ limit: limit,
422
+ include_total: include_total,
423
+ cursor: cursor,
424
+ fields: fields ? Array(fields) : nil,
425
+ async: async_request,
426
+ ui: ui,
427
+ webhook: webhook
428
+ }.compact
429
+
430
+ postAPIRequest('/businesses', payload)
431
+ end
432
+
433
+ def businessesIterSearch(filters: {}, limit: 10, fields: nil, include_total: false)
434
+ cursor = nil
435
+ all_items = []
436
+
437
+ loop do
438
+ page = businessesSearch(
439
+ filters: filters,
440
+ limit: limit,
441
+ include_total: include_total,
442
+ cursor: cursor,
443
+ fields: fields,
444
+ async_request: false
445
+ )
446
+
447
+ items = page.is_a?(Hash) ? (page['items'] || []) : []
448
+ break if !items.is_a?(Array) || items.empty?
449
+
450
+ all_items.concat(items)
451
+
452
+ has_more = !!(page['has_more'])
453
+ next_cursor = page['next_cursor']
454
+ break if !has_more || next_cursor.nil? || next_cursor.to_s.strip.empty?
455
+
456
+ cursor = next_cursor.to_s
457
+ end
458
+
459
+ all_items
460
+ end
461
+
462
+ def businessesGet(business_id, fields: nil, async_request: false, ui: false, webhook: nil)
463
+ raise ArgumentError, 'business_id is required' if business_id.nil? || business_id.to_s.strip.empty?
464
+
465
+ fields_param =
466
+ if fields.is_a?(Array)
467
+ fields.map(&:to_s).join(',')
468
+ else
469
+ fields
470
+ end
471
+
472
+ response = self.class.get("/businesses/#{CGI.escape(business_id.to_s)}", query: {
473
+ fields: fields_param,
474
+ async: async_request,
475
+ ui: ui,
476
+ webhook: webhook
477
+ }.compact).parsed_response
478
+ response.is_a?(Hash) && response.key?('data') ? response['data'] : response
479
+ end
394
480
  end
395
481
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outscraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Outscraper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-08 00:00:00.000000000 Z
11
+ date: 2026-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty