proxy_fetcher 0.6.3 → 0.6.4

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
2
  SHA1:
3
- metadata.gz: f7ade86090b2c8dca7aa7d20a47fdf63334507e2
4
- data.tar.gz: 0256d5fa29f0ec451f2248ab280dc71878c3e05f
3
+ metadata.gz: 72290c2f3d9a544d65874bfd0c6ff98c38938ed0
4
+ data.tar.gz: c57b914d49204016231bc565f0ec03a98cf8893b
5
5
  SHA512:
6
- metadata.gz: c598b1a286e45d96e40ee9772365ece447d9dd18054fbdf80e727b086181b8b0cac9c5933898d74364ed95301da35855a368ea6c81cd41a4e26e355a92b1f1b7
7
- data.tar.gz: 3cc0c7c348d63abb9fde40aadf3730d176fb7de59dbd51036082d605a9bf50614eb7f19a103f9ee448078d73dabf05e666911ee97cd9c7f30e0d1fe64a57ef21
6
+ metadata.gz: dacd5882b6397ec980ce35040b10ef5c5aa0eca57cb7e708d71fc60de67a5375e351a2021a4e37804a6eab629ae3a792ca4b523d9675c1af1ad5fafb6e21c589
7
+ data.tar.gz: a2e0fabc4062f425871751f72af4bafae315d5b4e0f8795b0f6532ca7a2fd4fff8d948d348869dbd9c8f382fcc0dae66b0ae504f0bdac0cb71e729a2ad54568a
@@ -81,7 +81,7 @@ module ProxyFetcher
81
81
  # clean text
82
82
  #
83
83
  def clear(text)
84
- return if text.nil? || text.empty?
84
+ return '' if text.nil? || text.empty?
85
85
 
86
86
  text.strip.gsub(/[ \t]/i, '')
87
87
  end
@@ -7,7 +7,7 @@ module ProxyFetcher
7
7
  # Loads proxy provider page content, extract proxy list from it
8
8
  # and convert every entry to proxy object.
9
9
  def fetch_proxies!(filters = {})
10
- load_proxy_list(filters).map { |html| to_proxy(html) }
10
+ load_proxy_list(filters).map { |html_node| to_proxy(html_node) }
11
11
  end
12
12
 
13
13
  # Just synthetic sugar to make it easier to call #fetch_proxies! method.
@@ -25,7 +25,7 @@ module ProxyFetcher
25
25
  def to_proxy(html_node)
26
26
  ProxyFetcher::Proxy.new.tap do |proxy|
27
27
  proxy.addr = html_node.content_at('td[1]')
28
- proxy.port = Integer(html_node.content_at('td[2]'))
28
+ proxy.port = Integer(html_node.content_at('td[2]').gsub(/^0+/, ''))
29
29
  proxy.country = html_node.content_at('td[4]')
30
30
  proxy.anonymity = html_node.content_at('td[5]')
31
31
  proxy.type = parse_type(html_node)
@@ -32,7 +32,7 @@ module ProxyFetcher
32
32
  def to_proxy(html_node)
33
33
  ProxyFetcher::Proxy.new.tap do |proxy|
34
34
  proxy.addr = html_node.content_at('td[1]')
35
- proxy.port = Integer(html_node.content_at('td[2]'))
35
+ proxy.port = Integer(html_node.content_at('td[2]').gsub(/^0+/, ''))
36
36
  proxy.country = html_node.content_at('td[4]')
37
37
  proxy.anonymity = html_node.content_at('td[5]')
38
38
  proxy.type = ProxyFetcher::Proxy::HTTPS
@@ -31,7 +31,7 @@ module ProxyFetcher
31
31
  def to_proxy(html_node)
32
32
  ProxyFetcher::Proxy.new.tap do |proxy|
33
33
  proxy.addr = html_node.content_at('td[2]')
34
- proxy.port = Integer(html_node.content_at('td[3]'))
34
+ proxy.port = Integer(html_node.content_at('td[3]').gsub(/^0+/, ''))
35
35
  proxy.anonymity = html_node.content_at('td[4]')
36
36
  proxy.country = html_node.content_at('td[6]')
37
37
  proxy.response_time = Integer(html_node.content_at('td[7]'))
@@ -15,7 +15,7 @@ module ProxyFetcher
15
15
  # Minor version number
16
16
  MINOR = 6
17
17
  # Smallest version number
18
- TINY = 3
18
+ TINY = 4
19
19
 
20
20
  # Full version number
21
21
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
@@ -5,7 +5,6 @@ require 'proxy_fetcher/version'
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'proxy_fetcher'
7
7
  gem.version = ProxyFetcher.gem_version
8
- gem.date = '2018-02-13'
9
8
  gem.summary = 'Ruby gem for dealing with proxy lists from different providers'
10
9
  gem.description = 'This gem can help your Ruby application to make HTTP(S) requests ' \
11
10
  'using proxies by fetching and validating proxy lists from the different providers.'
@@ -45,7 +45,9 @@ describe ProxyFetcher::Client do
45
45
 
46
46
  it 'successfully returns page content using custom proxy' do
47
47
  manager = ProxyFetcher::Manager.new
48
- content = ProxyFetcher::Client.get('http://httpbin.org', options: { proxy: manager.get! })
48
+
49
+ proxy = manager.get! until proxy
50
+ content = ProxyFetcher::Client.get('http://httpbin.org', options: { proxy: proxy })
49
51
 
50
52
  expect(content).not_to be_nil
51
53
  expect(content).not_to be_empty
@@ -1,3 +1,3 @@
1
1
  RSpec.describe ProxyFetcher::VERSION do
2
- it { expect(ProxyFetcher::VERSION::STRING).to eq '0.6.3' }
2
+ it { expect(ProxyFetcher::VERSION::STRING).to eq '0.6.4' }
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Bulai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec