proxied 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: 9e64762e0a727e0f5523d9cae41d35a6af65d1ad736ec206185a57129011c09d
4
- data.tar.gz: a9a6a3686aefc30494b787977de830b2a6c82fa1e0c5efb24448bdcb35d73376
3
+ metadata.gz: b3bbcb9decf2bbc7405eb32c8f83f1622b8308c3649c4167761dde1111921ca7
4
+ data.tar.gz: ff215e09d9e4521af77d4509daa3498cba20562c6b815d21794d650a58928ad0
5
5
  SHA512:
6
- metadata.gz: 72154e04ecdc6feb1b4bdf3785bf0477044829e57afd0c100b63ca2fd72073fc6f84447c579f388378d977cbdfce6d98a40a033dbc93ccd4e0bb9ab34362e9af
7
- data.tar.gz: 6d916e4a0ef2a42cccc47c45d60a32deabc5b4367faa99431090453bd3b9e0fd010d85f2c9ef718d4ac14f4e75f59d8950e4e938d45a18ceb9f8feb0463f0baf
6
+ metadata.gz: 3120f47302c4de30d0bdb031ecb8431fec435e91b838cce56605fd31ea2be4e7c00156ea7c3606260b149558c39d8d317de1f61e1537fc775580451e597a2add
7
+ data.tar.gz: 16a5276b5ebe536b77c15bbca3fe0f55bdda4a254f0ac95dd3ef6918a574af9c81a790847e275cf668091a7c8a5301b389ba403276d60ec09618a9242bbe832a
@@ -1,50 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proxied (0.1.7)
4
+ proxied (0.1.8)
5
5
  faraday (>= 0.14)
6
6
  net-ssh (>= 4.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.0)
12
- actionpack (= 5.2.0)
11
+ actioncable (5.2.1)
12
+ actionpack (= 5.2.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.0)
16
- actionpack (= 5.2.0)
17
- actionview (= 5.2.0)
18
- activejob (= 5.2.0)
15
+ actionmailer (5.2.1)
16
+ actionpack (= 5.2.1)
17
+ actionview (= 5.2.1)
18
+ activejob (= 5.2.1)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.0)
22
- actionview (= 5.2.0)
23
- activesupport (= 5.2.0)
21
+ actionpack (5.2.1)
22
+ actionview (= 5.2.1)
23
+ activesupport (= 5.2.1)
24
24
  rack (~> 2.0)
25
25
  rack-test (>= 0.6.3)
26
26
  rails-dom-testing (~> 2.0)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.0)
29
- activesupport (= 5.2.0)
28
+ actionview (5.2.1)
29
+ activesupport (= 5.2.1)
30
30
  builder (~> 3.1)
31
31
  erubi (~> 1.4)
32
32
  rails-dom-testing (~> 2.0)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.0)
35
- activesupport (= 5.2.0)
34
+ activejob (5.2.1)
35
+ activesupport (= 5.2.1)
36
36
  globalid (>= 0.3.6)
37
- activemodel (5.2.0)
38
- activesupport (= 5.2.0)
39
- activerecord (5.2.0)
40
- activemodel (= 5.2.0)
41
- activesupport (= 5.2.0)
37
+ activemodel (5.2.1)
38
+ activesupport (= 5.2.1)
39
+ activerecord (5.2.1)
40
+ activemodel (= 5.2.1)
41
+ activesupport (= 5.2.1)
42
42
  arel (>= 9.0)
43
- activestorage (5.2.0)
44
- actionpack (= 5.2.0)
45
- activerecord (= 5.2.0)
43
+ activestorage (5.2.1)
44
+ actionpack (= 5.2.1)
45
+ activerecord (= 5.2.1)
46
46
  marcel (~> 0.3.1)
47
- activesupport (5.2.0)
47
+ activesupport (5.2.1)
48
48
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
49
  i18n (>= 0.7, < 2)
50
50
  minitest (~> 5.1)
@@ -73,7 +73,7 @@ GEM
73
73
  diff-lcs (1.3)
74
74
  equalizer (0.0.11)
75
75
  erubi (1.7.1)
76
- faraday (0.15.2)
76
+ faraday (0.15.3)
77
77
  multipart-post (>= 1.2, < 3)
78
78
  generator_spec (0.9.4)
79
79
  activesupport (>= 3.0.0)
@@ -81,7 +81,7 @@ GEM
81
81
  globalid (0.4.1)
82
82
  activesupport (>= 4.2.0)
83
83
  hashdiff (0.3.7)
84
- i18n (1.0.1)
84
+ i18n (1.1.0)
85
85
  concurrent-ruby (~> 1.0)
86
86
  ice_nine (0.11.2)
87
87
  loofah (2.2.2)
@@ -89,11 +89,11 @@ GEM
89
89
  nokogiri (>= 1.5.9)
90
90
  mail (2.7.0)
91
91
  mini_mime (>= 0.1.1)
92
- marcel (0.3.2)
92
+ marcel (0.3.3)
93
93
  mimemagic (~> 0.3.2)
94
94
  method_source (0.9.0)
95
95
  mimemagic (0.3.2)
96
- mini_mime (1.0.0)
96
+ mini_mime (1.0.1)
97
97
  mini_portile2 (2.3.0)
98
98
  minitest (5.11.3)
99
99
  multipart-post (2.0.0)
@@ -104,53 +104,53 @@ GEM
104
104
  pry (0.11.3)
105
105
  coderay (~> 1.1.0)
106
106
  method_source (~> 0.9.0)
107
- public_suffix (3.0.2)
107
+ public_suffix (3.0.3)
108
108
  rack (2.0.5)
109
- rack-test (1.0.0)
109
+ rack-test (1.1.0)
110
110
  rack (>= 1.0, < 3)
111
- rails (5.2.0)
112
- actioncable (= 5.2.0)
113
- actionmailer (= 5.2.0)
114
- actionpack (= 5.2.0)
115
- actionview (= 5.2.0)
116
- activejob (= 5.2.0)
117
- activemodel (= 5.2.0)
118
- activerecord (= 5.2.0)
119
- activestorage (= 5.2.0)
120
- activesupport (= 5.2.0)
111
+ rails (5.2.1)
112
+ actioncable (= 5.2.1)
113
+ actionmailer (= 5.2.1)
114
+ actionpack (= 5.2.1)
115
+ actionview (= 5.2.1)
116
+ activejob (= 5.2.1)
117
+ activemodel (= 5.2.1)
118
+ activerecord (= 5.2.1)
119
+ activestorage (= 5.2.1)
120
+ activesupport (= 5.2.1)
121
121
  bundler (>= 1.3.0)
122
- railties (= 5.2.0)
122
+ railties (= 5.2.1)
123
123
  sprockets-rails (>= 2.0.0)
124
124
  rails-dom-testing (2.0.3)
125
125
  activesupport (>= 4.2.0)
126
126
  nokogiri (>= 1.6)
127
127
  rails-html-sanitizer (1.0.4)
128
128
  loofah (~> 2.2, >= 2.2.2)
129
- railties (5.2.0)
130
- actionpack (= 5.2.0)
131
- activesupport (= 5.2.0)
129
+ railties (5.2.1)
130
+ actionpack (= 5.2.1)
131
+ activesupport (= 5.2.1)
132
132
  method_source
133
133
  rake (>= 0.8.7)
134
- thor (>= 0.18.1, < 2.0)
134
+ thor (>= 0.19.0, < 2.0)
135
135
  rake (12.3.1)
136
136
  rdoc (6.0.4)
137
- rspec-core (3.7.1)
138
- rspec-support (~> 3.7.0)
139
- rspec-expectations (3.7.0)
137
+ rspec-core (3.8.0)
138
+ rspec-support (~> 3.8.0)
139
+ rspec-expectations (3.8.1)
140
140
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.7.0)
142
- rspec-mocks (3.7.0)
141
+ rspec-support (~> 3.8.0)
142
+ rspec-mocks (3.8.0)
143
143
  diff-lcs (>= 1.2.0, < 2.0)
144
- rspec-support (~> 3.7.0)
145
- rspec-rails (3.7.2)
144
+ rspec-support (~> 3.8.0)
145
+ rspec-rails (3.8.0)
146
146
  actionpack (>= 3.0)
147
147
  activesupport (>= 3.0)
148
148
  railties (>= 3.0)
149
- rspec-core (~> 3.7.0)
150
- rspec-expectations (~> 3.7.0)
151
- rspec-mocks (~> 3.7.0)
152
- rspec-support (~> 3.7.0)
153
- rspec-support (3.7.1)
149
+ rspec-core (~> 3.8.0)
150
+ rspec-expectations (~> 3.8.0)
151
+ rspec-mocks (~> 3.8.0)
152
+ rspec-support (~> 3.8.0)
153
+ rspec-support (3.8.0)
154
154
  safe_yaml (1.0.4)
155
155
  sprockets (3.7.2)
156
156
  concurrent-ruby (~> 1.0)
@@ -32,14 +32,17 @@ module Proxied
32
32
  return proxies
33
33
  end
34
34
 
35
- def get_valid_proxies(protocol: :all, proxy_type: :all, maximum_failed_attempts: nil, retries: 3)
35
+ def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
36
36
  proxies = get_proxies_for_protocol_and_proxy_type(protocol, proxy_type)
37
37
  proxies = proxies.where(valid_proxy: true)
38
38
  proxies = proxies.where(:failed_attempts.lte => maximum_failed_attempts) if maximum_failed_attempts
39
+ proxies = proxies.where(category: category) unless category.to_s.empty?
39
40
  end
40
41
 
41
- def get_random_proxy(protocol: :all, proxy_type: :all, maximum_failed_attempts: nil, retries: 3)
42
- proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, maximum_failed_attempts: maximum_failed_attempts)
42
+ def get_random_proxy(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil, retries: 3)
43
+ proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, category: category, maximum_failed_attempts: maximum_failed_attempts)
44
+ proxies = yield(proxies) if block_given?
45
+
43
46
  proxy = nil
44
47
 
45
48
  begin
@@ -21,16 +21,18 @@ module Proxied
21
21
  return proxies
22
22
  end
23
23
 
24
- def get_valid_proxies(protocol: :all, proxy_type: :all, maximum_failed_attempts: nil)
24
+ def get_valid_proxies(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
25
25
  proxies = get_proxies_for_protocol_and_proxy_type(protocol, proxy_type)
26
26
  proxies = proxies.where(["valid_proxy = ? AND last_checked_at IS NOT NULL", true])
27
27
  proxies = proxies.where(["failed_attempts <= ?", maximum_failed_attempts]) if maximum_failed_attempts
28
+ proxies = proxies.where(category: category) unless category.to_s.empty?
28
29
 
29
30
  return proxies
30
31
  end
31
32
 
32
- def get_random_proxy(protocol: :all, proxy_type: :all, maximum_failed_attempts: nil)
33
- proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, maximum_failed_attempts: maximum_failed_attempts)
33
+ def get_random_proxy(protocol: :all, proxy_type: :all, category: nil, maximum_failed_attempts: nil)
34
+ proxies = get_valid_proxies(protocol: protocol, proxy_type: proxy_type, category: category, maximum_failed_attempts: maximum_failed_attempts)
35
+ proxies = yield(proxies) if block_given?
34
36
 
35
37
  order_clause = case ActiveRecord::Base.connection.class.name
36
38
  when "ActiveRecord::ConnectionAdapters::MysqlAdapter", "ActiveRecord::ConnectionAdapters::Mysql2Adapter"
@@ -1,3 +1,3 @@
1
1
  module Proxied
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxied
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday