soapy_bing 0.0.2 → 0.0.3

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: 69461ab0d24161a2d94ee614764bc6e1f7bbe699
4
- data.tar.gz: 3b72c16582297107d5e5b6d24c2f196317959d2b
3
+ metadata.gz: 237915c983f873488f70f4a41230f71df20fc592
4
+ data.tar.gz: 78cbf493d4cd5ad557267ed4f7b79a890ece2567
5
5
  SHA512:
6
- metadata.gz: 38ca5529a8c3aead01f3788d7a70653fe02548d6dafc9d71cdad03732042bc5b0233f3ef95fb807d789c01392424c7f6064ac3677007992152108b28d658520c
7
- data.tar.gz: 3c3616e09ec1463c962d42aa687f794722d4e783e0eef3519d6e2c28d7a415c28616e761da5b069b721065ca5196c19f35ee019c75b809d29579d9da491b30ba
6
+ metadata.gz: 3818fc941c819b77cb99676394099d5ff6ef5a3879218a9071dc358490ca263239256829b4620a4282629c9aa9c472235be0d66d1d59e1cc67d0fa6b4601ae9c
7
+ data.tar.gz: 498a63f0cd2e66f7d4d69422cba816723d7d3742b7ced04ec3276409bc50deb686b8d55ccbc8e1d01f9b6103d3cebfbf2f3d5475fb5cc73cf9b4b5a8706225a5
@@ -1,4 +1,5 @@
1
1
  require 'ostruct'
2
+ require 'uri'
2
3
  require 'httparty'
3
4
  require 'zip'
4
5
 
@@ -8,6 +9,7 @@ module SoapyBing
8
9
  class Base
9
10
  class UnknownParserError < StandardError; end
10
11
  include Helpers::ClassName
12
+ include Helpers::SSLVersion
11
13
 
12
14
  DEFAULT_REPORT_SETTINGS = {
13
15
  format: 'Csv',
@@ -62,7 +64,9 @@ module SoapyBing
62
64
  end
63
65
 
64
66
  def download_io
65
- StringIO.new HTTParty.get(download_url).body
67
+ https = URI.parse(download_url).scheme == 'https'
68
+ request_options = https ? { ssl_version: ssl_version } : {}
69
+ StringIO.new HTTParty.get(download_url, request_options).body
66
70
  end
67
71
 
68
72
  def request_id
@@ -0,0 +1,17 @@
1
+ require 'openssl'
2
+
3
+ module SoapyBing
4
+ module Helpers
5
+ module SSLVersion
6
+ DEFAULT_SSL_VERSION = :SSLv3
7
+
8
+ def ssl_version
9
+ if OpenSSL::SSL::SSLContext::METHODS.include? DEFAULT_SSL_VERSION
10
+ DEFAULT_SSL_VERSION
11
+ else
12
+ OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version]
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1 +1,2 @@
1
1
  require 'soapy_bing/helpers/class_name'
2
+ require 'soapy_bing/helpers/ssl_version'
@@ -1,3 +1,3 @@
1
1
  module SoapyBing
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
@@ -0,0 +1,23 @@
1
+ RSpec.describe SoapyBing::Helpers::SSLVersion do
2
+ describe '#ssl_version' do
3
+ subject { stub_const('MyClass', Class.new.include(described_class)).new.ssl_version }
4
+
5
+ context 'when DEFAULT_SSL_VERSION is available' do
6
+ before do
7
+ stub_const('OpenSSL::SSL::SSLContext::METHODS', [described_class::DEFAULT_SSL_VERSION])
8
+ end
9
+
10
+ it 'responds with DEFAULT_SSL_VERSION' do
11
+ expect(subject).to be MyClass::DEFAULT_SSL_VERSION
12
+ end
13
+ end
14
+
15
+ context 'when DEFAULT_SSL_VERSION is not available' do
16
+ before { stub_const('OpenSSL::SSL::SSLContext::METHODS', []) }
17
+
18
+ it 'responds with OpenSSL default version' do
19
+ expect(subject).to be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version]
20
+ end
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soapy_bing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
@@ -203,6 +203,7 @@ files:
203
203
  - lib/soapy_bing/ads/reports/parsers/csv_parser.rb
204
204
  - lib/soapy_bing/helpers.rb
205
205
  - lib/soapy_bing/helpers/class_name.rb
206
+ - lib/soapy_bing/helpers/ssl_version.rb
206
207
  - lib/soapy_bing/oauth_credentials.rb
207
208
  - lib/soapy_bing/param_guard.rb
208
209
  - lib/soapy_bing/soap.rb
@@ -238,6 +239,7 @@ files:
238
239
  - spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb
239
240
  - spec/soapy_bing/ads_spec.rb
240
241
  - spec/soapy_bing/helpers/class_name_spec.rb
242
+ - spec/soapy_bing/helpers/ssl_version_spec.rb
241
243
  - spec/soapy_bing/oauth_credentials_spec.rb
242
244
  - spec/soapy_bing/param_guard_spec.rb
243
245
  - spec/soapy_bing/soap/request/base_spec.rb
@@ -290,6 +292,7 @@ test_files:
290
292
  - spec/soapy_bing/ads/reports/parsers/csv_parser_spec.rb
291
293
  - spec/soapy_bing/ads_spec.rb
292
294
  - spec/soapy_bing/helpers/class_name_spec.rb
295
+ - spec/soapy_bing/helpers/ssl_version_spec.rb
293
296
  - spec/soapy_bing/oauth_credentials_spec.rb
294
297
  - spec/soapy_bing/param_guard_spec.rb
295
298
  - spec/soapy_bing/soap/request/base_spec.rb