ms_rest_azure 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: 1f02aa4a5f0f8b2921a5e860162384b487efec77
4
- data.tar.gz: 22e137ece42e719d79266148e10262fc84dc6a11
3
+ metadata.gz: e6245c14af0d65fe5cccfd8179024358a9cb761a
4
+ data.tar.gz: b48d9d6a00ce589692c9531c5b3e9ce8adf78645
5
5
  SHA512:
6
- metadata.gz: b33afbd1c77c7c466befa4f5c7960e9fd1c0c4f5a3415f2e35739ed96ae18b4b2fce47ea22e16f456a5e9654cfca838ca4b9c6d098d6761da5a9e982b8968eb8
7
- data.tar.gz: 7b6f2991cf5430cb0eca947aeacd648c7e0c2dcb18147a66c94e981d59b5e7f5761f29f0008624b0a71e755eab018d526b1afaf36aeb621068b7f703888d9a6e
6
+ metadata.gz: 8cb8d7448eb7ffc1ffd99777544b1c5ae690d5a0ab0575d246010f7775f4ab5b1757ec10a2294cefee9572d2e773e4730c3eecb900699f537c9835cbfce9e2fb
7
+ data.tar.gz: 221dc02de7944922bf8819d61e49ac3737162098deaa658b8ba5ba2cd111dc206d0facfec2d8fe083f67d09b6920b48d40ed3211f88db9e81e3b68033f007b8e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ##2016.10.05 ms_rest_azure 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 AzureServiceClient [#1447](https://github.com/Azure/autorest/pull/1447)
4
+ * Improved AzureOperationError class to expose error_message and error_code properties [#1450](https://github.com/Azure/autorest/pull/1450)
5
+
1
6
  ##2016.09.15 ms_rest_azure version 0.5.0
2
7
  * Updating ms_rest dependecy to version 0.5.0
3
8
  * Adding known Azure Environments in ruby runtime for easy discovery
data/README.md CHANGED
@@ -4,7 +4,6 @@ MsRestAzure is a library which supports the Azure clients (SDKs) generated with
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
@@ -38,7 +37,7 @@ To start working on the gem the only additional dev dependecy is required - rspe
38
37
  Reference it in the gemfile and also add this line to your client's gemspec file:
39
38
 
40
39
  ```ruby
41
- spec.add_runtime_dependency 'ms_rest_azure', '~> 0.5.0'
40
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.6.0'
42
41
  ```
43
42
 
44
43
  Don't forget to correct the version.
@@ -7,5 +7,34 @@ module MsRestAzure
7
7
  # Class which represents an Azure error.
8
8
  #
9
9
  class AzureOperationError < MsRest::HttpOperationError
10
+
11
+ # @return [String] the error message.
12
+ attr_accessor :error_message
13
+
14
+ # @return [String] the error code.
15
+ attr_accessor :error_code
16
+
17
+ #
18
+ # Creates and initialize new instance of the AzureOperationError class.
19
+ # @param [Hash] the HTTP request data (uri, body, headers).
20
+ # @param [Faraday::Response] the HTTP response object.
21
+ # @param [String] body the HTTP response body.
22
+ # @param [String] error message.
23
+ #
24
+ def initialize(*args)
25
+ super(*args)
26
+
27
+ # Try to parse @body to find useful error message and code
28
+ # Body should meet the error condition response requirements for Microsoft REST API Guidelines
29
+ # https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#7102-error-condition-responses
30
+ begin
31
+ unless @body.nil?
32
+ @error_message = @body['error']['message']
33
+ @error_code = @body['error']['code']
34
+ @msg = "#{@msg}: #{@error_code}: #{@error_message}"
35
+ end
36
+ rescue
37
+ end
38
+ end
10
39
  end
11
40
  end
@@ -14,6 +14,13 @@ module MsRestAzure
14
14
  # @return [String] api version of the Azure in string format.
15
15
  attr_accessor :api_version
16
16
 
17
+ def initialize(credentials, options = nil)
18
+ super(credentials, options)
19
+ @request_headers = {
20
+ 'Content-Type' => 'application/json;charset=utf-8' # This is the current default for Azure services, and content-type supported by Autorest
21
+ }
22
+ end
23
+
17
24
  #
18
25
  # Retrieves the result of 'POST','DELETE','PUT' or 'PATCH' operation. Performs polling of required.
19
26
  # @param azure_response [MsRestAzure::AzureOperationResponse] response from Azure service.
@@ -245,6 +252,19 @@ module MsRestAzure
245
252
 
246
253
  result
247
254
  end
255
+
256
+
257
+ private
258
+ #
259
+ # Retrieves a new instance of the AzureOperationResponse class.
260
+ # @param [MsRest::HttpOperationRequest] request the HTTP request object.
261
+ # @param [Faraday::Response] response the HTTP response object.
262
+ # @param [String] body the HTTP response body.
263
+ # @return [MsRestAzure::AzureOperationResponse] the operation response.
264
+ #
265
+ def create_response(request, http_response, body = nil)
266
+ AzureOperationResponse.new(request, http_response, body)
267
+ end
248
268
  end
249
269
 
250
270
  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 MsRestAzure
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_azure
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
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.5.0
117
+ version: 0.6.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.5.0
124
+ version: 0.6.0
125
125
  description: Azure Client Library for Ruby.
126
126
  email: azsdkteam@microsoft.com
127
127
  executables: []
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: 1.9.3
160
+ version: 2.0.0
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - ">="