ms_rest 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 692425031e50a67bb0c2a2986fd1c3127c4da8f8
4
- data.tar.gz: c26b98593b21e2064abf743947456d06e9ee11da
3
+ metadata.gz: e5346c1d76e65732fc9eb348f2f6c0df57e95e99
4
+ data.tar.gz: 7f3121e731e8980401e0722ea98e279d4f2828b4
5
5
  SHA512:
6
- metadata.gz: c2627b4529ead4ee2e2ff859a8fe2410603e014ef81236dfb9f6c88041fdf0cb53a9046453c328a3f41d7ac172864d226e8fe9d65326eb50fede789f0f67a8e3
7
- data.tar.gz: f370e8591c20565da3de48eb23537e9a96199c9ae14552fe12cbe5e1084df502297e5da0cce047d113efb2a205df69a3edf961a045defe869886b99c52c1c2ac
6
+ metadata.gz: 4437f60f960a208ccc2050447e7518a5ae9b90fdf0a402dac11e7a236cf6a05498535fbd89fdb4cf928cadbb90518c73b2e70520a23b6d8407589a4afed17bb3
7
+ data.tar.gz: c237de0bfc1fd9367c68e2c38f92cbe30919e819590d4a483b8ea969c606c7a48463967f448035b9859568b3ea45ca21b2b2dbfe7f2d9b752a83ab88af761833
@@ -1,3 +1,8 @@
1
+ ##2016.10.05 ms_rest version 0.6.0
2
+ * Minimum supported Ruby version is 2.0.0 [#1463](https://github.com/Azure/autorest/pull/1463)
3
+ * Implemented generic request method for ServiceClient [#1447](https://github.com/Azure/autorest/pull/1447)
4
+ * Bug fix for merging query parameters [#1443](https://github.com/Azure/autorest/pull/1443)
5
+
1
6
  ##2016.09.15 ms_rest version 0.5.0
2
7
  * Bundling default ca-cert and exposing method for providing ssl options
3
8
 
data/README.md CHANGED
@@ -4,7 +4,6 @@ MsRest is a library which supports the clients (SDKs) generated with Autorest to
4
4
 
5
5
  # Supported Ruby Versions
6
6
 
7
- * Ruby 1.9.3
8
7
  * Ruby 2.0
9
8
  * Ruby 2.1
10
9
  * Ruby 2.2
@@ -49,7 +48,7 @@ To start working on the gem the only additional dev dependecy is required - rspe
49
48
  Reference it in the gemfile and also add this line to your client's gemspec file:
50
49
 
51
50
  ```ruby
52
- spec.add_runtime_dependency 'ms_rest', '~> 0.5.0'
51
+ spec.add_runtime_dependency 'ms_rest', '~> 0.6.0'
53
52
  ```
54
53
 
55
54
  Don't forget to correct the version.
@@ -24,6 +24,7 @@ module MsRest
24
24
  # @param [Faraday::Response] the HTTP response object.
25
25
  # @param [String] body the HTTP response body.
26
26
  # @param [String] error message.
27
+ #
27
28
  def initialize(*args)
28
29
  @msg = self.class.name
29
30
  if args.size == 1
@@ -76,9 +76,9 @@ module MsRest
76
76
  faraday.response :logger, nil, { :bodies => logging == 'full' }
77
77
  end
78
78
  end
79
-
79
+
80
80
  @connection.run_request(:"#{method}", build_path, body, {'User-Agent' => user_agent}.merge(headers)) do |req|
81
- req.params = query_params.reject{|_, v| v.nil?} unless query_params.nil?
81
+ req.params = req.params.merge(query_params.reject{|_, v| v.nil?}) unless query_params.nil?
82
82
  yield(req) if block_given?
83
83
  end
84
84
  end
@@ -11,6 +11,12 @@ module MsRest
11
11
  # @return [MsRest::ServiceClientCredentials] the credentials object.
12
12
  attr_accessor :credentials
13
13
 
14
+ # @return [Hash{String=>String}] default middlewares configuration for requests.
15
+ attr_accessor :middlewares
16
+
17
+ # @return [Hash{String=>String}] default request headers for requests.
18
+ attr_accessor :request_headers
19
+
14
20
  #
15
21
  # Creates and initialize new instance of the ServiceClient class.
16
22
  #
@@ -20,7 +26,43 @@ module MsRest
20
26
  #
21
27
  def initialize(credentials, options = nil)
22
28
  @credentials = credentials
29
+ @request_headers = {}
30
+ @middlewares = {middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]}
23
31
  end
32
+
33
+ #
34
+ # @param base_url [String] the base url for the request.
35
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
36
+ # @param path [String] the path, relative to {base_url}.
37
+ # @param options [Hash{String=>String}] specifying any request options like :credentials, :body, etc.
38
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
39
+ #
40
+ def make_request_async(base_url, method, path, options = {})
41
+ options = @middlewares.merge(options)
42
+ options[:credentials] = options[:credentials] || @credentials
43
+ request = MsRest::HttpOperationRequest.new(base_url, path, method, options)
44
+ promise = request.run_promise do |req|
45
+ options[:credentials].sign_request(req) unless options[:credentials].nil?
46
+ end
47
+ promise = promise.then do |http_response|
48
+ response_content = http_response.body.to_s.empty? ? nil : http_response.body
49
+ # Create response
50
+ create_response(request, http_response, response_content)
51
+ end
52
+ promise.execute
53
+ end
54
+
55
+ private
56
+ #
57
+ # Retrieves a new instance of the HttpOperationResponse class.
58
+ # @param [MsRest::HttpOperationRequest] request the HTTP request object.
59
+ # @param [Faraday::Response] response the HTTP response object.
60
+ # @param [String] body the HTTP response body.
61
+ # @return [MsRest::HttpOperationResponse] the operation response.
62
+ #
63
+ def create_response(request, http_response, body = nil)
64
+ HttpOperationResponse.new(request, http_response, body)
65
+ end
24
66
  end
25
67
 
26
68
  #
@@ -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.5.0'
6
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.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-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: 1.9.3
149
+ version: 2.0.0
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - ">="