contact-data 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/bin/ssl_doctor.rb +12 -13
- data/contact-data.gemspec +1 -0
- data/lib/contact-data/fetcher.rb +4 -3
- data/lib/contact-data/version.rb +1 -1
- data/spec/fetcher_spec.rb +2 -1
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92710752e40c09411abd997d9476c3095398eb3a
|
4
|
+
data.tar.gz: 77a5b04868616c15d5f5371e7dace6f333ec6e60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68cac8c97cc721963cd46ab4c2161ba944139ae03345cd1bf7dd705305ae59fe9f895191b6677f3e0f79028a52449d152e91c18ed02c3066402c0d2307fae71c
|
7
|
+
data.tar.gz: 52a83068bb801a2c0c8269302de09dc80d556358496fe192e8c0cf88fd9ceaf0c402de9456bea0d0c53a2d2210ebcb0645a83114740b9dc32172518afb4c42ab
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/bin/ssl_doctor.rb
CHANGED
@@ -12,16 +12,15 @@ port ||= 443
|
|
12
12
|
|
13
13
|
ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
14
14
|
ruby_version = RUBY_VERSION
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
puts "%s (%s)" % [ruby, ruby_version]
|
15
|
+
patch = RbConfig::CONFIG['PATCHLEVEL']
|
16
|
+
ruby_version += "-p#{patch}" if patch
|
17
|
+
puts format('%s (%s)', ruby, ruby_version)
|
19
18
|
|
20
19
|
openssl_dir = OpenSSL::X509::DEFAULT_CERT_AREA
|
21
20
|
mac_openssl = '/System/Library/OpenSSL' == openssl_dir
|
22
|
-
puts
|
21
|
+
puts format('%s: %s', OpenSSL::OPENSSL_VERSION, openssl_dir)
|
23
22
|
[OpenSSL::X509::DEFAULT_CERT_DIR_ENV, OpenSSL::X509::DEFAULT_CERT_FILE_ENV].each do |key|
|
24
|
-
puts
|
23
|
+
puts format('%s=%s', key, ENV[key].to_s.inspect)
|
25
24
|
end
|
26
25
|
|
27
26
|
ca_file = ENV[OpenSSL::X509::DEFAULT_CERT_FILE_ENV] || OpenSSL::X509::DEFAULT_CERT_FILE
|
@@ -47,9 +46,9 @@ if mac_openssl
|
|
47
46
|
# cert verification fail for requests that would otherwise be successful.
|
48
47
|
else
|
49
48
|
http.verify_callback = lambda { |verify_ok, store_context|
|
50
|
-
|
49
|
+
unless verify_ok
|
51
50
|
failed_cert = store_context.current_cert
|
52
|
-
failed_cert_reason =
|
51
|
+
failed_cert_reason = format('%d: %s', store_context.error, store_context.error_string)
|
53
52
|
end
|
54
53
|
verify_ok
|
55
54
|
}
|
@@ -61,9 +60,9 @@ req = Net::HTTP::Head.new('/', 'user-agent' => user_agent)
|
|
61
60
|
begin
|
62
61
|
res = http.start { http.request(req) }
|
63
62
|
abort res.inspect if res.code.to_i >= 500
|
64
|
-
puts
|
63
|
+
puts 'OK'
|
65
64
|
rescue Errno::ECONNREFUSED
|
66
|
-
puts
|
65
|
+
puts 'Error: connection refused'
|
67
66
|
exit 1
|
68
67
|
rescue OpenSSL::SSL::SSLError => e
|
69
68
|
puts "#{e.class}: #{e.message}"
|
@@ -72,7 +71,7 @@ rescue OpenSSL::SSL::SSLError => e
|
|
72
71
|
puts "\nThe server presented a certificate that could not be verified:"
|
73
72
|
puts " subject: #{failed_cert.subject}"
|
74
73
|
puts " issuer: #{failed_cert.issuer}"
|
75
|
-
puts
|
74
|
+
puts format(' error code %s', failed_cert_reason)
|
76
75
|
end
|
77
76
|
|
78
77
|
ca_file_missing = !File.exist?(ca_file) && !mac_openssl
|
@@ -80,8 +79,8 @@ rescue OpenSSL::SSL::SSLError => e
|
|
80
79
|
|
81
80
|
if ca_file_missing || ca_path_empty
|
82
81
|
puts "\nPossible causes:"
|
83
|
-
puts " `%s' does not exist"
|
84
|
-
puts " `%s/' is empty"
|
82
|
+
puts format(" `%s' does not exist", ca_file) if ca_file_missing
|
83
|
+
puts format(" `%s/' is empty", ca_path) if ca_path_empty
|
85
84
|
end
|
86
85
|
|
87
86
|
exit 1
|
data/contact-data.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'webmock', '~> 1.21'
|
30
30
|
spec.add_development_dependency 'byebug', '~> 5.0'
|
31
31
|
spec.add_development_dependency 'rubocop', '~> 0.31'
|
32
|
+
spec.add_development_dependency 'listen', '~> 3.0', '< 3.1' # Dependency of guard, 3.1 requires Ruby 2.2+
|
32
33
|
spec.add_development_dependency 'guard', '~> 2.12'
|
33
34
|
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
34
35
|
spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
data/lib/contact-data/fetcher.rb
CHANGED
@@ -62,8 +62,9 @@ module ContactData
|
|
62
62
|
return @json if @json
|
63
63
|
logger.info { "Using #{display_method} for #{url}" }
|
64
64
|
@json = RestClient::Request.new(args).execute
|
65
|
-
rescue RestClient::Exception, SocketError => e
|
66
|
-
|
65
|
+
rescue RestClient::Exception, SocketError, Net::HTTPBadGateway => e
|
66
|
+
message = "#{e.message} when trying to #{display_method} url: #{url} with options #{options}"
|
67
|
+
raise ContactData::FetchError, message, e.backtrace
|
67
68
|
end
|
68
69
|
|
69
70
|
def args
|
@@ -76,7 +77,7 @@ module ContactData
|
|
76
77
|
:method, :url, :headers, :cookies, :payload, :user, :password, :timeout, :max_redirects, :open_timeout,
|
77
78
|
:raw_response, :processed_headers, :ssl_opts, :verify_ssl, :ssl_client_cert, :ssl_client_key, :ssl_ca_file,
|
78
79
|
:ssl_ca_path, :ssl_cert_store, :ssl_verify_callback, :ssl_verify_callback_warnings, :ssl_version, :ssl_ciphers
|
79
|
-
].each { |key| @args[key] = options[key] if options.key? key }
|
80
|
+
].each { |key| @args[key] = options[key] if options.key? key } # TODO: surely this is just a merge?
|
80
81
|
|
81
82
|
@args
|
82
83
|
end
|
data/lib/contact-data/version.rb
CHANGED
data/spec/fetcher_spec.rb
CHANGED
@@ -12,7 +12,8 @@ describe ContactData::Fetcher do
|
|
12
12
|
|
13
13
|
expect { ContactData::Fetcher.get(method) }.to raise_error { |e|
|
14
14
|
expect(e).to be_an(ContactData::FetchError)
|
15
|
-
message =
|
15
|
+
message = '500 Internal Server Error when trying to GET ' \
|
16
|
+
"url: #{ContactData::Fetcher::URL}/#{method}.json with options {}"
|
16
17
|
expect(e.message).to eq(message)
|
17
18
|
}
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -164,6 +164,26 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.31'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: listen
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '3.0'
|
174
|
+
- - "<"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '3.1'
|
177
|
+
type: :development
|
178
|
+
prerelease: false
|
179
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '3.0'
|
184
|
+
- - "<"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '3.1'
|
167
187
|
- !ruby/object:Gem::Dependency
|
168
188
|
name: guard
|
169
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
293
|
version: '0'
|
274
294
|
requirements: []
|
275
295
|
rubyforge_project:
|
276
|
-
rubygems_version: 2.
|
296
|
+
rubygems_version: 2.6.4
|
277
297
|
signing_key:
|
278
298
|
specification_version: 4
|
279
299
|
summary: 'Example: ContactData.search(''John Smith III'')'
|