waz-storage 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,13 +60,14 @@ module WAZ
60
60
 
61
61
  # Lists all the blobs inside the given container.
62
62
  def list_blobs(container_name)
63
- content = execute(:get, container_name, { :comp => 'list'})
63
+ content = execute(:get, container_name, { :restype => 'container', :comp => 'list'}, {:x_ms_version => '2009-09-19'})
64
64
  doc = REXML::Document.new(content)
65
65
  containers = []
66
66
  REXML::XPath.each(doc, '//Blob/') do |item|
67
67
  containers << { :name => REXML::XPath.first(item, "Name").text,
68
68
  :url => REXML::XPath.first(item, "Url").text,
69
- :content_type => REXML::XPath.first(item, "ContentType").text }
69
+ :content_type => REXML::XPath.first(item.elements["Properties"], "Content-Type").text }
70
+
70
71
  end
71
72
  return containers
72
73
  end
@@ -23,7 +23,7 @@ module WAZ
23
23
  http_headers = {}
24
24
  headers.each{ |k, v| http_headers[k.to_s.gsub(/_/, '-')] = v} unless headers.nil?
25
25
  http_headers.merge!("x-ms-Date" => Time.new.httpdate)
26
- http_headers.merge!("Content-Length" => (payload or "").length)
26
+ http_headers.merge!("Content-Length" => (payload or "").size)
27
27
  request = {:headers => http_headers, :method => verb.to_s.downcase.to_sym, :url => url, :payload => payload}
28
28
  request[:headers].merge!("Authorization" => "SharedKey #{account_name}:#{generate_signature(request)}")
29
29
  return RestClient::Request.new(request)
@@ -69,8 +69,8 @@ module WAZ
69
69
 
70
70
  signature += canonicalize_headers(options[:headers]) + "\x0A" unless self.type_of_service == 'table'
71
71
  signature += canonicalize_message(options[:url])
72
-
73
- Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.access_key)).update(signature.toutf8).digest)
72
+ signature = signature.toutf8 if(signature.respond_to? :toutf8)
73
+ Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.access_key)).update(signature).digest)
74
74
  end
75
75
 
76
76
  def generate_signature20090919(options = {})
@@ -88,8 +88,9 @@ module WAZ
88
88
  (options[:headers]["Range"] or "")+ "\x0A" +
89
89
  canonicalize_headers(options[:headers]) + "\x0A" +
90
90
  canonicalize_message20090919(options[:url])
91
-
92
- Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.access_key)).update(signature.toutf8).digest)
91
+
92
+ signature = signature.toutf8 if(signature.respond_to? :toutf8)
93
+ Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.access_key)).update(signature).digest)
93
94
  end
94
95
 
95
96
  def canonicalize_message20090919(url)
@@ -3,7 +3,7 @@ module WAZ
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = '1'
5
5
  MINOR = '0'
6
- TINY = '4'
6
+ TINY = '5'
7
7
  end
8
8
 
9
9
  Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY].compact * '.'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waz-storage
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Johnny G. Halife
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-05 00:00:00 -03:00
18
+ date: 2011-03-19 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency