outscraper 0.3.3 → 0.3.4

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: b226c0d690b74a7dbbb8607a448a77038e9fbd63b1353afe75a316c4124d28c5
4
- data.tar.gz: 3a6fcc25a46e9308f78c25de4493fc7d4e3b7eedebc0013827dcb51e76abe2af
3
+ metadata.gz: e490638335315130985cc5b8f5c2c268b72a56142fb4c06383dabff1ecfd3ece
4
+ data.tar.gz: 2ef885848538c535630b6ded859f0fa8657fd36455e45fe07a7da93bc5180ad9
5
5
  SHA512:
6
- metadata.gz: c81d7bcf948d7e50a5df01eccc8b5a9e24dfd2d3b166ac134a36e6622515c3579c6cb090dc05c71b8cb87124e6c18963c1f408c7d0ca0cf17d4a6d8b20ff5cf1
7
- data.tar.gz: 26ba1c97c2f46ec65af900b031cd06f994e4dcb7d6bce1cd245f5c2d67070bbaa5e2f7caa302a39c71d15097d9ff4740a072627db8556384c3ac6a93b82ad340
6
+ metadata.gz: 732b1c087ccf83a52193fe54afaf03a0fa31d642dfab11c03c587a04b427df9df2962e0b259690e7e49c3a2de77d36901fc89f9e60953d17aadd836300609780
7
+ data.tar.gz: 8a8c95af2d738edc5aba671ee0f1005302c6674a81ca5c7c9830c4f8f6b0b4cc53823da594af1df51e6da175b3d81d798ab779c4dc1aa6cb65ea382910e0b779
@@ -0,0 +1,32 @@
1
+ # Emails And Contacts Scraper With Ruby
2
+
3
+ Returns directions between two points from Google Maps. [Outscraper API](https://app.outscraper.cloud/api-docs#tag/Google/paths/~1maps~1directions/get).
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+ ```bash
9
+ bundle add outscraper
10
+ ```
11
+
12
+ If bundler is not being used to manage dependencies, install the gem by executing:
13
+ ```bash
14
+ gem install outscraper
15
+ ```
16
+
17
+ [Link to the Ruby package page](https://rubygems.org/gems/outscraper)
18
+
19
+ ## Initialization
20
+ ```ruby
21
+ require 'Outscraper'
22
+
23
+ client = Outscraper::Client.new('SECRET_API_KEY')
24
+ ```
25
+ [Link to the profile page to create the API key](https://app.outscraper.com/profile)
26
+
27
+ ## Usage
28
+
29
+ ```ruby
30
+ # Returns directions:
31
+ results = client.google_maps_directions(['29.696596, 76.994928 30.7159662444353, 76.8053887016268', '29.696596, 76.994928 30.723065, 76.770169'])
32
+ ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Outscraper
4
- VERSION = "0.3.3"
4
+ VERSION = "0.3.4"
5
5
  end
data/lib/outscraper.rb CHANGED
@@ -4,6 +4,19 @@ require "httparty"
4
4
 
5
5
  require_relative "outscraper/version"
6
6
 
7
+ QUERY_DELIMITER = ' '
8
+
9
+ def format_direction_queries(q)
10
+ if q.is_a?(Array) && !q.empty? && q.first.is_a?(Array)
11
+ return q.map { |pair| pair.join(QUERY_DELIMITER) }
12
+ end
13
+
14
+ return q if q.is_a?(Array)
15
+
16
+ [q]
17
+ end
18
+
19
+
7
20
  module Outscraper
8
21
  class Client
9
22
  include HTTParty
@@ -61,10 +74,10 @@ module Outscraper
61
74
  }).parsed_response['data']
62
75
  end
63
76
 
64
- def google_maps_directions(origin: '', destination: '', departure_time: nil, finish_time: nil, interval: nil, travel_mode: 'best', language: 'en', region: nil, fields: nil, async_request: true)
77
+ def google_maps_directions(query:, departure_time: nil, finish_time: nil, interval: nil, travel_mode: 'best', language: 'en', region: nil, fields: nil, async_request: true)
78
+ queries = format_direction_queries(query)
65
79
  response = self.class.get('/maps/directions', query: {
66
- origin: Array(origin),
67
- destination: Array(destination),
80
+ query: queries,
68
81
  departure_time: departure_time,
69
82
  finish_time: finish_time,
70
83
  interval: interval,
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.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Outscraper
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-28 00:00:00.000000000 Z
11
+ date: 2025-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -44,6 +44,7 @@ files:
44
44
  - examples/Contacts And Leads.md
45
45
  - examples/Email Addresses Finder.md
46
46
  - examples/Emails And Contacts.md
47
+ - examples/Google Directions.md
47
48
  - examples/Google Maps Photos Scraper.md
48
49
  - examples/Google Maps Reviews.md
49
50
  - examples/Google Maps.md