httply 0.1.8 → 0.1.9

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: 897b5428ff155316657fd49bde52bcbd96872ad66d8608bd6536829c6e1378a5
4
- data.tar.gz: dc73c1e39caef1c6b6015fe25d1848a3abf807e98d2f61a9a7a4fd4ac152e09d
3
+ metadata.gz: b7a4ab9b01b8b05a2b6719e008577e909f7d34abf8b8fe119d2ae29760eca61b
4
+ data.tar.gz: d2acbc10fa201caffa6f5c0d827dd5b1abfa036ac91a31914d0ef22e863e01d2
5
5
  SHA512:
6
- metadata.gz: 1c95df2a649f13688efcd859e6d651efc6f0709a9f1a115491e2a7cf685a8cb5e2a5ad7e86fe9db863eaa5debcd11a533611f48ae887b2299693bfaa096166ab
7
- data.tar.gz: e5d28e96750e945e6338a15d0617751e3bc260907a01c4b69eac5c5d9dba06158a59c90115a5ba59d5e036a469f228c7e0d32768069aa401a8e554d2ce86917b
6
+ metadata.gz: e04a34309d5a77fd04f1418c96f03ef77034c247f8d33a397ba824cfdac10c9c38bca2ea4c665ed7278e7e29ed52ca940ce197d1e77bb8a218c7edcd518618dd
7
+ data.tar.gz: 877de8c7af979b63c1aec8b69e56ef3a06bdb750f3f39cd6bfd828bc14ca48f14ab3b6ce92afe0f85fb10ef6d76d6696c464d51d432a267a1958a80e1ace7e6e
data/.gitignore CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  /spec/data/
11
11
 
12
+ .ruby-version
13
+
12
14
  /bin/.pry_history
13
15
  .pry_history
14
16
 
@@ -1,56 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- httply (0.1.7)
5
- agents (>= 0.1.4)
6
- faraday (>= 0.15.4)
7
- faraday_middleware (>= 0.13.1)
4
+ httply (0.1.9)
5
+ agents (~> 0.1.4)
6
+ faraday (~> 1.0, >= 1.0.1)
7
+ faraday_middleware (~> 1.0)
8
8
  multi_xml (~> 0.6.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  agents (0.1.4)
14
- coderay (1.1.2)
15
- diff-lcs (1.3)
16
- faraday (0.15.4)
14
+ coderay (1.1.3)
15
+ diff-lcs (1.4.4)
16
+ faraday (1.0.1)
17
17
  multipart-post (>= 1.2, < 3)
18
- faraday_middleware (0.13.1)
19
- faraday (>= 0.7.4, < 1.0)
20
- method_source (0.9.2)
18
+ faraday_middleware (1.0.0)
19
+ faraday (~> 1.0)
20
+ method_source (1.0.0)
21
21
  mini_portile2 (2.4.0)
22
22
  multi_xml (0.6.0)
23
23
  multipart-post (2.1.1)
24
- nokogiri (1.10.4)
24
+ nokogiri (1.10.10)
25
25
  mini_portile2 (~> 2.4.0)
26
- pry (0.12.2)
27
- coderay (~> 1.1.0)
28
- method_source (~> 0.9.0)
29
- rake (10.5.0)
30
- rspec (3.8.0)
31
- rspec-core (~> 3.8.0)
32
- rspec-expectations (~> 3.8.0)
33
- rspec-mocks (~> 3.8.0)
34
- rspec-core (3.8.2)
35
- rspec-support (~> 3.8.0)
36
- rspec-expectations (3.8.4)
26
+ pry (0.13.1)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
29
+ rake (13.0.1)
30
+ rspec (3.9.0)
31
+ rspec-core (~> 3.9.0)
32
+ rspec-expectations (~> 3.9.0)
33
+ rspec-mocks (~> 3.9.0)
34
+ rspec-core (3.9.2)
35
+ rspec-support (~> 3.9.3)
36
+ rspec-expectations (3.9.2)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.8.0)
39
- rspec-mocks (3.8.1)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-mocks (3.9.1)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.8.0)
42
- rspec-support (3.8.2)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-support (3.9.3)
43
43
 
44
44
  PLATFORMS
45
45
  ruby
46
46
 
47
47
  DEPENDENCIES
48
- bundler (~> 1.17)
48
+ bundler (~> 2.1, >= 2.1.4)
49
49
  httply!
50
- nokogiri (~> 1.10)
51
- pry (~> 0.12.2)
52
- rake (~> 10.0)
53
- rspec (~> 3.0)
50
+ nokogiri (~> 1.10, >= 1.10.10)
51
+ pry (~> 0.13.1)
52
+ rake (~> 13.0, >= 13.0.1)
53
+ rspec (~> 3.9)
54
54
 
55
55
  BUNDLED WITH
56
- 1.17.2
56
+ 2.1.4
@@ -23,16 +23,16 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency "faraday", ">= 0.15.4"
27
- spec.add_dependency "faraday_middleware", ">= 0.13.1"
28
- spec.add_dependency "agents", ">= 0.1.4"
29
- spec.add_dependency "multi_xml", "~> 0.6.0"
26
+ spec.add_dependency 'faraday', '~> 1.0', '>= 1.0.1'
27
+ spec.add_dependency 'faraday_middleware', '~> 1.0'
28
+ spec.add_dependency 'agents', '~> 0.1.4'
29
+ spec.add_dependency 'multi_xml', '~> 0.6.0'
30
30
 
31
- spec.add_development_dependency "bundler", "~> 1.17"
32
- spec.add_development_dependency "rake", "~> 10.0"
33
- spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency 'bundler', '~> 2.1', '>= 2.1.4'
32
+ spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
33
+ spec.add_development_dependency 'rspec', '~> 3.9'
34
34
 
35
- spec.add_development_dependency "pry", "~> 0.12.2"
35
+ spec.add_development_dependency 'pry', '~> 0.13.1'
36
36
 
37
- spec.add_development_dependency "nokogiri", "~> 1.10"
37
+ spec.add_development_dependency 'nokogiri', '~> 1.10', '>= 1.10.10'
38
38
  end
@@ -109,8 +109,8 @@ module Httply
109
109
 
110
110
  builder.use ::FaradayMiddleware::FollowRedirects, limit: redirects if redirects && redirects > 0
111
111
 
112
- if proxy
113
- builder.proxy = generate_faraday_proxy(proxy)
112
+ if proxy && !proxy.empty?
113
+ builder.proxy = proxy
114
114
  log("Will use proxy: #{builder.proxy.inspect}")
115
115
  end
116
116
 
@@ -19,6 +19,10 @@ module Httply
19
19
  elsif proxy_model_defined? && options.is_a?(::Proxy)
20
20
  proxy = proxy_from_object(options, proxy)
21
21
  end
22
+
23
+ if proxy && !proxy.empty?
24
+ proxy = proxy.has_key?(:uri) ? proxy : generate_faraday_proxy(proxy)
25
+ end
22
26
  end
23
27
 
24
28
  return proxy
@@ -37,25 +41,28 @@ module Httply
37
41
  end
38
42
 
39
43
  def proxy_from_hash(options, proxy)
40
- host = options.fetch(:host, nil)
41
- port = options.fetch(:port, nil)
42
-
43
- username = options.fetch(:username, nil)
44
- password = options.fetch(:password, nil)
45
-
46
- randomize = options.fetch(:randomize, true)
44
+ randomize = options.fetch(:randomize, false)
47
45
  type = options.fetch(:type, :all)
48
- protocol = options.fetch(:protocol, :all)
46
+ protocol = options.fetch(:protocol, :http)
49
47
 
50
48
  if randomize && proxy_model_defined?
51
49
  proxy_object = ::Proxy.get_random_proxy(protocol: protocol, proxy_type: type)
52
50
  proxy = proxy_from_object(proxy_object, proxy)
53
51
  else
54
- if host && port
55
- proxy[:host] = host
56
- proxy[:port] = port
52
+ uri = options.fetch(:uri, nil)
53
+
54
+ if uri.to_s.empty?
55
+ host = options.fetch(:host, nil)
56
+ port = options.fetch(:port, nil)
57
+
58
+ username = options.fetch(:username, nil)
59
+ password = options.fetch(:password, nil)
57
60
 
58
- proxy = set_credentials(username, password, proxy)
61
+ if !host.to_s.empty? && !port.to_s.empty?
62
+ proxy[:host] = host
63
+ proxy[:port] = port
64
+ proxy = set_credentials(username, password, proxy)
65
+ end
59
66
  end
60
67
  end
61
68
 
@@ -1,3 +1,3 @@
1
1
  module Httply
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,55 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Johnsson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: 0.15.4
22
+ version: 1.0.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: 0.15.4
32
+ version: 1.0.1
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ">="
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.13.1
39
+ version: '1.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ">="
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.13.1
46
+ version: '1.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: agents
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - ">="
51
+ - - "~>"
46
52
  - !ruby/object:Gem::Version
47
53
  version: 0.1.4
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - ">="
58
+ - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: 0.1.4
55
61
  - !ruby/object:Gem::Dependency
@@ -72,56 +78,68 @@ dependencies:
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '1.17'
81
+ version: '2.1'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.1.4
76
85
  type: :development
77
86
  prerelease: false
78
87
  version_requirements: !ruby/object:Gem::Requirement
79
88
  requirements:
80
89
  - - "~>"
81
90
  - !ruby/object:Gem::Version
82
- version: '1.17'
91
+ version: '2.1'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 2.1.4
83
95
  - !ruby/object:Gem::Dependency
84
96
  name: rake
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
99
  - - "~>"
88
100
  - !ruby/object:Gem::Version
89
- version: '10.0'
101
+ version: '13.0'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 13.0.1
90
105
  type: :development
91
106
  prerelease: false
92
107
  version_requirements: !ruby/object:Gem::Requirement
93
108
  requirements:
94
109
  - - "~>"
95
110
  - !ruby/object:Gem::Version
96
- version: '10.0'
111
+ version: '13.0'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 13.0.1
97
115
  - !ruby/object:Gem::Dependency
98
116
  name: rspec
99
117
  requirement: !ruby/object:Gem::Requirement
100
118
  requirements:
101
119
  - - "~>"
102
120
  - !ruby/object:Gem::Version
103
- version: '3.0'
121
+ version: '3.9'
104
122
  type: :development
105
123
  prerelease: false
106
124
  version_requirements: !ruby/object:Gem::Requirement
107
125
  requirements:
108
126
  - - "~>"
109
127
  - !ruby/object:Gem::Version
110
- version: '3.0'
128
+ version: '3.9'
111
129
  - !ruby/object:Gem::Dependency
112
130
  name: pry
113
131
  requirement: !ruby/object:Gem::Requirement
114
132
  requirements:
115
133
  - - "~>"
116
134
  - !ruby/object:Gem::Version
117
- version: 0.12.2
135
+ version: 0.13.1
118
136
  type: :development
119
137
  prerelease: false
120
138
  version_requirements: !ruby/object:Gem::Requirement
121
139
  requirements:
122
140
  - - "~>"
123
141
  - !ruby/object:Gem::Version
124
- version: 0.12.2
142
+ version: 0.13.1
125
143
  - !ruby/object:Gem::Dependency
126
144
  name: nokogiri
127
145
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +147,9 @@ dependencies:
129
147
  - - "~>"
130
148
  - !ruby/object:Gem::Version
131
149
  version: '1.10'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 1.10.10
132
153
  type: :development
133
154
  prerelease: false
134
155
  version_requirements: !ruby/object:Gem::Requirement
@@ -136,6 +157,9 @@ dependencies:
136
157
  - - "~>"
137
158
  - !ruby/object:Gem::Version
138
159
  version: '1.10'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 1.10.10
139
163
  description: Httply is a lightweight wrapper around Faraday to support automatic randomization
140
164
  of proxies and user agents, amongst other things.
141
165
  email:
@@ -146,7 +170,6 @@ extra_rdoc_files: []
146
170
  files:
147
171
  - ".gitignore"
148
172
  - ".rspec"
149
- - ".ruby-version"
150
173
  - ".travis.yml"
151
174
  - CODE_OF_CONDUCT.md
152
175
  - Gemfile
@@ -184,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
207
  - !ruby/object:Gem::Version
185
208
  version: '0'
186
209
  requirements: []
187
- rubygems_version: 3.0.3
210
+ rubygems_version: 3.1.2
188
211
  signing_key:
189
212
  specification_version: 4
190
213
  summary: Httply - lightweight Faraday wrapper
@@ -1 +0,0 @@
1
- 2.6.3