azure-core 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/lib/azure/core/http/http_error.rb +36 -20
- data/lib/azure/core/http/http_request.rb +1 -1
- data/lib/azure/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9633ae4d67b96a41ca289286b59a6acfb3eada61
|
4
|
+
data.tar.gz: 6b13301832d6cd68b9c16f78b9eea614a78d93ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bec89582a3c07f810cb4874bf92c5313f9c0ba3ac78569031ceeee05524120822c46d2de3328b7a21ea9fb2cadecd7abb0c658bd29efdb1ac1d3a037b27f13d
|
7
|
+
data.tar.gz: 3e93068317140579daef9a4d931d4de91ad0f732221f1af0a7bb6c4c445f3242eff3453b6d4f7db5b6d164a67576e59c1703c63aad4479266c1dcaf16a13f6b0
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 2017.08.31 - azure-core gem @version 0.1.12
|
2
|
+
* Changed default value of header `MaxDataServiceVersion` to `3.0;NetFx` now that the service is available.
|
3
|
+
* `Azure::Core::Http::HTTPError` now can also parse JSON format response body for error type and description.
|
4
|
+
|
1
5
|
# 2017.08.18 - azure-core gem @version 0.1.11
|
2
6
|
* Changed 'nokogiri' to runtime dependency with version >= 1.6, and added documentation to resolve dependency issue to Readme for users with Ruby version lower than 2.2.0.
|
3
7
|
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#--------------------------------------------------------------------------
|
15
15
|
require 'azure/core/error'
|
16
16
|
require 'nokogiri'
|
17
|
+
require 'json'
|
17
18
|
|
18
19
|
module Azure
|
19
20
|
module Core
|
@@ -80,29 +81,44 @@ module Azure
|
|
80
81
|
#
|
81
82
|
# Returns nothing
|
82
83
|
def parse_response
|
83
|
-
if @http_response.body && @http_response.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
84
|
+
if @http_response.body && @http_response.respond_to?(:headers) && @http_response.headers['Content-Type']
|
85
|
+
if @http_response.headers['Content-Type'].include?('xml')
|
86
|
+
parse_xml_response
|
87
|
+
elsif @http_response.headers['Content-Type'].include?('json')
|
88
|
+
parse_json_response
|
89
|
+
end
|
90
|
+
else
|
91
|
+
parse_unknown_response
|
92
|
+
end
|
93
|
+
end
|
91
94
|
|
92
|
-
|
93
|
-
|
95
|
+
def parse_xml_response
|
96
|
+
document = Nokogiri.Slop(@http_response.body)
|
97
|
+
|
98
|
+
@type = document.css('code').first.text if document.css('code').any?
|
99
|
+
@type = document.css('Code').first.text if document.css('Code').any?
|
100
|
+
@description = document.css('message').first.text if document.css('message').any?
|
101
|
+
@description = document.css('Message').first.text if document.css('Message').any?
|
102
|
+
@header = document.css('headername').first.text if document.css('headername').any?
|
103
|
+
@header = document.css('HeaderName').first.text if document.css('HeaderName').any?
|
104
|
+
@header_value = document.css('headervalue').first.text if document.css('headervalue').any?
|
105
|
+
@header_value = document.css('HeaderValue').first.text if document.css('HeaderValue').any?
|
106
|
+
|
107
|
+
# service bus uses detail instead of message
|
108
|
+
@detail = document.css('detail').first.text if document.css('detail').any?
|
109
|
+
@detail = document.css('Detail').first.text if document.css('Detail').any?
|
110
|
+
end
|
94
111
|
|
95
|
-
|
96
|
-
|
112
|
+
def parse_json_response
|
113
|
+
odata_error = JSON.parse(@http_response.body)['odata.error']
|
114
|
+
@type = odata_error['code']
|
115
|
+
@description = odata_error['message']['value']
|
116
|
+
end
|
97
117
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
@type = 'Unknown'
|
103
|
-
if @http_response.body
|
104
|
-
@description = "#{@http_response.body.strip}"
|
105
|
-
end
|
118
|
+
def parse_unknown_response
|
119
|
+
@type = 'Unknown'
|
120
|
+
if @http_response.body
|
121
|
+
@description = "#{@http_response.body.strip}"
|
106
122
|
end
|
107
123
|
end
|
108
124
|
|
@@ -121,7 +121,7 @@ module Azure
|
|
121
121
|
def_headers['x-ms-date'] = current_time
|
122
122
|
def_headers['x-ms-version'] = '2014-02-14'
|
123
123
|
def_headers['DataServiceVersion'] = '1.0;NetFx'
|
124
|
-
def_headers['MaxDataServiceVersion'] = '
|
124
|
+
def_headers['MaxDataServiceVersion'] = '3.0;NetFx'
|
125
125
|
def_headers['Content-Type'] = 'application/atom+xml; charset=utf-8'
|
126
126
|
end
|
127
127
|
end
|
data/lib/azure/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
211
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
212
|
+
rubygems_version: 2.6.13
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Core library to be consumed by Ruby SDK gems
|