ms_rest 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,7 +68,7 @@ module MsRest
68
68
  # @return [URI] body the HTTP response body.
69
69
  def run_promise(&block)
70
70
  Concurrent::Promise.new do
71
- @connection ||= Faraday.new(:url => base_uri) do |faraday|
71
+ @connection ||= Faraday.new(:url => base_uri, :ssl => MsRest.ssl_options) do |faraday|
72
72
  middlewares.each{ |args| faraday.use(*args) } unless middlewares.nil?
73
73
  faraday.adapter Faraday.default_adapter
74
74
  logging = ENV['AZURE_HTTP_LOGGING'] || log
@@ -23,4 +23,31 @@ module MsRest
23
23
  end
24
24
  end
25
25
 
26
+ #
27
+ # Hash of SSL options for Faraday connection. Default is nil.
28
+ #
29
+ @@ssl_options = nil
30
+
31
+ #
32
+ # Stores the SSL options to be used for Faraday connections.
33
+ # ==== Examples
34
+ # MsRest.use_ssl_cert # => Uses bundled certificate for all the connections
35
+ # MsRest.use_ssl_cert({:ca_file => "path_to_ca_file"}) # => Uses supplied certificate for all the connections
36
+ #
37
+ # @param ssl_options [Hash] Hash of SSL options for Faraday connection. It defaults to the bundled certificate.
38
+ #
39
+ def self.use_ssl_cert(ssl_options = nil)
40
+ if ssl_options.nil?
41
+ @@ssl_options = {:ca_file => File.expand_path(File.join(File.dirname(__FILE__), '../..', 'ca-cert.pem')) }
42
+ else
43
+ @@ssl_options = ssl_options
44
+ end
45
+ end
46
+
47
+ #
48
+ # @return [Hash] Hash of SSL options to be used for Faraday connection.
49
+ #
50
+ def self.ssl_options
51
+ @@ssl_options
52
+ end
26
53
  end
@@ -3,5 +3,5 @@
3
3
  # Licensed under the MIT License. See License.txt in the project root for license information.
4
4
 
5
5
  module MsRest
6
- VERSION = '0.4.0'
6
+ VERSION = '0.5.0'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,13 +114,10 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - ".gitignore"
118
- - ".travis.yml"
119
- - ChangeLog.md
120
- - Gemfile
117
+ - CHANGELOG.md
121
118
  - LICENSE.txt
122
119
  - README.md
123
- - Rakefile
120
+ - ca-cert.pem
124
121
  - lib/ms_rest.rb
125
122
  - lib/ms_rest/credentials/basic_authentication_credentials.rb
126
123
  - lib/ms_rest/credentials/service_client_credentials.rb
@@ -137,7 +134,6 @@ files:
137
134
  - lib/ms_rest/service_client.rb
138
135
  - lib/ms_rest/validation_error.rb
139
136
  - lib/ms_rest/version.rb
140
- - ms_rest.gemspec
141
137
  homepage: https://github.com/Azure/autorest
142
138
  licenses:
143
139
  - MIT
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- .ruby-version
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.5
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for license information.
4
-
5
- source 'https://rubygems.org'
6
-
7
- # Specify your gem's dependencies in ms_rest.gemspec
8
- gemspec
9
-
10
- group :test do
11
- gem 'rspec'
12
- end
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- # encoding: utf-8
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for license information.
4
-
5
- require "bundler/gem_tasks"
data/ms_rest.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # Copyright (c) Microsoft Corporation. All rights reserved.
2
- # Licensed under the MIT License. See License.txt in the project root for license information.
3
-
4
- # coding: utf-8
5
- lib = File.expand_path('../lib', __FILE__)
6
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
- require 'ms_rest/version'
8
-
9
- Gem::Specification.new do |spec|
10
- spec.name = 'ms_rest'
11
- spec.version = MsRest::VERSION
12
- spec.authors = 'Microsoft Corporation'
13
- spec.email = 'azsdkteam@microsoft.com'
14
-
15
- spec.summary = %q{Azure Client Library for Ruby.}
16
- spec.description = %q{Azure Client Library for Ruby.}
17
- spec.homepage = 'https://github.com/Azure/autorest'
18
- spec.license = 'MIT'
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = 'bin'
22
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
24
-
25
- spec.required_ruby_version = '>= 1.9.3'
26
-
27
- spec.add_development_dependency 'bundler', '~> 1.9'
28
- spec.add_development_dependency 'rake', '~> 10.0'
29
- spec.add_development_dependency 'rspec', '~> 3.3'
30
-
31
- spec.add_runtime_dependency 'json', '~> 1.7'
32
- spec.add_runtime_dependency 'timeliness', '~> 0.3'
33
- spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
34
- spec.add_runtime_dependency 'faraday', '~> 0.9'
35
- end