azure-core 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWZmZjQ2MWFkOGQ5NmExYzVmYzFhYmRiYThjYjZkZTFiNzEyY2YyNQ==
4
+ MDFlM2YyOWI3YTU0MjhkMGQ3NzM4MWVkM2FhOWEwZDRmYjE5NDVjZg==
5
5
  data.tar.gz: !binary |-
6
- ZWJlN2Q0MTEwMjZkMzI0YmJkZjA4ZDNjNzE3MTlmZTc3ZTFhNjFlNA==
6
+ MTQwZDBmNjlhMzhkYjViMmY2Mzg1MGYyODhmODhhZTlmZmUwMmFjZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWIzODE0NjU3MDY0ODBjZTFiZThlMzE2YzkwZDViYmViMzlmMzViNWFjMDJm
10
- YWM2NGYxYTBkZTYxZjVhYTYwYTEzZDE4ODUwNDc5NDVhNTNhYTEyMWUxOWRk
11
- N2EyMThjZTE3NzkwNzEzMmQwMTJiYTc4MzIxNDA4NmJkMTk2YTk=
9
+ ODNkZDg4ODRhZTAwY2I4NWQxNTQxMWRjYTk4MTQwODU1NzQ2ZWRkOGNlYzIx
10
+ NGY4NWFjZTUyY2Q3ZGJjNTAyZDNiNzA5MDU5ZGY1ODI1NjI2MjFiOTE2ZTcx
11
+ Y2UxZjdmZDM2YWU0NmNhMWYwOTJhYzRhNjYyNjFlYWZiMmRmOGE=
12
12
  data.tar.gz: !binary |-
13
- MWJjYTVmMzE5ODZhYThhZmNjODhiMmFjNjFkYzYwOWY1MDA5ZWJkMjEwZmJh
14
- NDA2NmY2NTJjNjkyMWFmMzE0ZjExYzMzNTUxZDc0NjViNmUxYjY5YzYxYWU4
15
- NGM4ZDk1ZjY0YmViOTFhN2JmNDgwZGM0NmYxMzZjYmZhMzY2MTE=
13
+ ZDBmODdjZGMwNzNhMGEyMWMwZGQ1YTgxODM1YzQwNTgyZDE1OWU1YjFkMDYz
14
+ YTdjZDY1YTE2ZjMzZmRjZTJmNDFjZTE2YzdlYmFmMzEyNmYyNDMwYTgyZDc5
15
+ ZGUzNTU4OTQ1NzcyNjAxNzc3YmJjYzIzZjA4M2MyZGUyZDMzNGU=
@@ -1,7 +1,12 @@
1
+ # 2016.8.19 - azure-core gem @version 0.1.3
2
+ * Set default open timeout for the request [#16](https://github.com/Azure/azure-ruby-asm-core/issues/16)
3
+ * Fixed the issue that debug filter cannot display the right request information when the signer filter is added [#15](https://github.com/Azure/azure-ruby-asm-core/issues/15)
4
+ * Fixed the unrecognized method in the MockHttpResponse class [#18](https://github.com/Azure/azure-ruby-asm-core/pull/18)
5
+
1
6
  # 2016.5.16 - azure-core gem @version 0.1.2
2
7
  * Return response instead of raising exception when there is a retry filter [#8](https://github.com/Azure/azure-ruby-asm-core/pull/8)
3
8
 
4
- ## 2016.4.18 - azure-core gem @version 0.1.1
9
+ # 2016.4.18 - azure-core gem @version 0.1.1
5
10
  * Can not upload file with spaces [#360](https://github.com/Azure/azure-sdk-for-ruby/issues/360)
6
11
 
7
12
  # 2016.4.14 - azure-core gem @version 0.1.0
data/README.md CHANGED
@@ -32,3 +32,6 @@ After checking out the repo, run `bundle install` to install dependencies. Then,
32
32
  ## Provide Feedback
33
33
 
34
34
  If you encounter any bugs with the library please file an issue.
35
+
36
+ # Code of Conduct
37
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -24,11 +24,9 @@ module Azure
24
24
 
25
25
  # Initialize the Signer.
26
26
  #
27
- # @param account_name [String] The account name. Defaults to the one in the
28
- # global configuration.
29
- # @param access_key [String] The access_key encoded in Base64. Defaults to the
30
- # one in the global configuration.
31
- def initialize(account_name=Azure.storage_account_name, access_key=Azure.storage_access_key)
27
+ # @param account_name [String] The account name.
28
+ # @param access_key [String] The access_key encoded in Base64.
29
+ def initialize(account_name, access_key)
32
30
  @account_name = account_name
33
31
  super(access_key)
34
32
  end
@@ -32,7 +32,7 @@ module Azure
32
32
  raise ArgumentError, 'Signing key must be provided'
33
33
  end
34
34
 
35
- @access_key = Base64.strict_decode64(access_key)
35
+ @access_key = access_key
36
36
  end
37
37
 
38
38
  # Generate an HMAC signature.
@@ -41,7 +41,7 @@ module Azure
41
41
  #
42
42
  # @return [String] a Base64 String signed with HMAC.
43
43
  def sign(body)
44
- signed = OpenSSL::HMAC.digest('sha256', access_key, body)
44
+ signed = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), access_key, body)
45
45
  Base64.strict_encode64(signed)
46
46
  end
47
47
 
@@ -32,7 +32,7 @@ module Azure
32
32
 
33
33
  def call(method, uri, body=nil, headers=nil)
34
34
  super(method, uri, body, headers) do |request|
35
- filters.each { |filter| request.with_filter filter } if filters
35
+ filters.reverse.each { |filter| request.with_filter filter } if filters
36
36
  end
37
37
  end
38
38
 
@@ -21,6 +21,14 @@ module Azure
21
21
  # Public: Class for handling all HTTP response errors
22
22
  class HTTPError < Azure::Core::Error
23
23
 
24
+ # Public: Detail of the response
25
+ #
26
+ # Returns an Azure::Core::Http::HttpResponse object
27
+ attr :http_response
28
+
29
+ # Public: The request URI
30
+ #
31
+ # Returns a String
24
32
  attr :uri
25
33
 
26
34
  # Public: The HTTP status code of this error
@@ -45,6 +53,16 @@ module Azure
45
53
  # Returns a String
46
54
  attr :detail
47
55
 
56
+ # Public: The header name whose value is invalid
57
+ #
58
+ # Returns a String
59
+ attr :header
60
+
61
+ # Public: The invalid header value
62
+ #
63
+ # Returns a String
64
+ attr :header_value
65
+
48
66
  # Public: Initialize an error
49
67
  #
50
68
  # http_response - An Azure::Core::HttpResponse
@@ -71,6 +89,12 @@ module Azure
71
89
  @description = document.css('message').first.text if document.css('message').any?
72
90
  @description = document.css('Message').first.text if document.css('Message').any?
73
91
 
92
+ @header = document.css('headername').first.text if document.css('headername').any?
93
+ @header = document.css('HeaderName').first.text if document.css('HeaderName').any?
94
+
95
+ @header_value = document.css('headervalue').first.text if document.css('headervalue').any?
96
+ @header_value = document.css('HeaderValue').first.text if document.css('HeaderValue').any?
97
+
74
98
  # service bus uses detail instead of message
75
99
  @detail = document.css('detail').first.text if document.css('detail').any?
76
100
  @detail = document.css('Detail').first.text if document.css('Detail').any?
@@ -81,6 +105,12 @@ module Azure
81
105
  end
82
106
  end
83
107
  end
108
+
109
+ def inspect
110
+ string = "#<#{self.class.name}:#{self.object_id} "
111
+ fields = self.instance_variables.map{|field| "#{field}: #{self.send(field.to_s.delete("@")).inspect}"}
112
+ string << fields.join(", ") << ">"
113
+ end
84
114
  end
85
115
  end
86
116
  end
@@ -127,14 +127,7 @@ module Azure
127
127
  end
128
128
 
129
129
  def http_setup
130
- http = @client.agents(uri)
131
-
132
- unless headers.nil?
133
- keep_alive = headers['Keep-Alive'] || headers['keep-alive']
134
- http.read_timeout = keep_alive.split('=').last.to_i unless keep_alive.nil?
135
- end
136
-
137
- http
130
+ @client.agents(uri)
138
131
  end
139
132
 
140
133
  def body=(body)
@@ -147,10 +140,7 @@ module Azure
147
140
  # @return [HttpResponse]
148
141
  def call
149
142
  conn = http_setup
150
- res = conn.run_request(method.to_sym, uri, nil, nil) do |req|
151
- req.body = body if body
152
- req.headers = headers if headers
153
- end
143
+ res = set_up_response(method.to_sym, uri, conn, headers ,body)
154
144
 
155
145
  response = HttpResponse.new(res)
156
146
  response.uri = uri
@@ -79,7 +79,7 @@ module Azure
79
79
  @body = body
80
80
  @headers = headers
81
81
  @headers.each { |k,v|
82
- @headers[k] = [v] unless v.respond_to? first
82
+ @headers[k] = [v] unless v.respond_to? 'first'
83
83
  }
84
84
  end
85
85
  attr_accessor :status
@@ -24,7 +24,7 @@ module Azure
24
24
  # Create a new instance of the SignedService
25
25
  #
26
26
  # @param signer [Azure::Core::Auth::Signer]. An implementation of Signer used for signing requests. (optional, Default=Azure::Core::Auth::SharedKey.new)
27
- # @param account_name [String] The account name (optional, Default=Azure.config.storage_account_name)
27
+ # @param account_name [String] The account name (optional, Default=Azure.storage_account_name)
28
28
  # @param options [Hash] options
29
29
  def initialize(signer=nil, account_name=nil, options={})
30
30
  super('', options)
@@ -18,7 +18,7 @@ module Azure
18
18
  class Version
19
19
  MAJOR = 0 unless defined? MAJOR
20
20
  MINOR = 1 unless defined? MINOR
21
- UPDATE = 2 unless defined? UPDATE
21
+ UPDATE = 3 unless defined? UPDATE
22
22
  PRE = nil unless defined? PRE
23
23
 
24
24
  class << self
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8" standalone="yes"?>
2
+ <Error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
3
+ <Code>InvalidHeaderValue</Code>
4
+ <Message>The value for one of the HTTP headers is not in the correct format.\nRequestId:266be2bc-0001-0018-1256-d3bb92000000\nTime:2016-07-01T05:06:32.5922690Z</Message>
5
+ <HeaderName>Range</HeaderName>
6
+ <HeaderValue>bytes=0-512</HeaderValue>
7
+ </Error>
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.2
4
+ version: 0.1.3
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: 2016-05-16 00:00:00.000000000 Z
12
+ date: 2016-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -185,6 +185,7 @@ files:
185
185
  - lib/azure/core/version.rb
186
186
  - lib/azure/http_response_helper.rb
187
187
  - test/fixtures/http_error.xml
188
+ - test/fixtures/http_invalid_header.xml
188
189
  - test/support/fixtures.rb
189
190
  - test/test_helper.rb
190
191
  homepage: http://github.com/Azure/azure-ruby-asm-core