waz-storage 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,6 +77,12 @@ module WAZ
77
77
  raise WAZ::Blobs::InvalidOperation if self.snapshot_date
78
78
  self.class.service_instance.set_blob_properties(path, properties)
79
79
  end
80
+
81
+ # Stores blob metadata. User metadata must be prefixed with 'x-ms-meta-'. The advantage of this over put_properties
82
+ # is that it only affect user_metadata and doesn't overwrite any system values, like 'content_type'.
83
+ def put_metadata!(metadata = {})
84
+ self.class.service_instance.set_blob_metadata(path, metadata)
85
+ end
80
86
 
81
87
  # Removes the blob from the container.
82
88
  def destroy!
@@ -112,4 +118,4 @@ module WAZ
112
118
  end
113
119
  end
114
120
  end
115
- end
121
+ end
@@ -103,6 +103,11 @@ module WAZ
103
103
  execute :put, path, { :comp => 'properties' }, properties.merge({:x_ms_version => "2009-09-19"})
104
104
  end
105
105
 
106
+ # Set user defined metadata - overwrites any previous metadata key:value pairs
107
+ def set_blob_metadata(path, metadata = {})
108
+ execute :put, path, { :comp => 'metadata' }, metadata.merge({:x_ms_version => "2009-09-19"})
109
+ end
110
+
106
111
  # Copies a blob within the same account (not necessarily to the same container)
107
112
  def copy_blob(source_path, dest_path)
108
113
  execute :put, dest_path, nil, { :x_ms_version => "2009-09-19", :x_ms_copy_source => canonicalize_message(source_path) }
@@ -133,4 +138,4 @@ module WAZ
133
138
  end
134
139
  end
135
140
  end
136
- end
141
+ end
@@ -34,7 +34,7 @@ module WAZ
34
34
  def generate_request_uri(path = nil, options = {})
35
35
  protocol = use_ssl ? "https" : "http"
36
36
  query_params = options.keys.sort{ |a, b| a.to_s <=> b.to_s}.map{ |k| "#{k.to_s.gsub(/_/, '')}=#{CGI.escape(options[k].to_s)}"}.join("&") unless options.nil? or options.empty?
37
- uri = "#{protocol}://#{base_url}/#{account_name}#{(path or "").start_with?("/") ? "" : "/"}#{(path or "")}" if !self.use_devenv.nil? and self.use_devenv
37
+ uri = "#{protocol}://#{base_url}/#{path.start_with?(account_name) ? "" : account_name }#{((path or "").start_with?("/") or path.start_with?(account_name)) ? "" : "/"}#{(path or "")}" if !self.use_devenv.nil? and self.use_devenv
38
38
  uri ||= "#{protocol}://#{account_name}.#{base_url}#{(path or "").start_with?("/") ? "" : "/"}#{(path or "")}"
39
39
  uri << "?#{query_params}" if query_params
40
40
  return uri
@@ -3,7 +3,7 @@ module WAZ
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = '1'
5
5
  MINOR = '0'
6
- TINY = '3'
6
+ TINY = '4'
7
7
  end
8
8
 
9
9
  Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY].compact * '.'
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waz-storage
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 31
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 3
9
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - Johnny G. Halife
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-18 00:00:00 -03:00
18
+ date: 2011-02-05 00:00:00 -03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rest-client
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: ruby-hmac
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 3
39
44
  segments:
40
45
  - 0
41
46
  version: "0"
@@ -85,23 +90,27 @@ rdoc_options:
85
90
  require_paths:
86
91
  - lib
87
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
88
94
  requirements:
89
95
  - - ">="
90
96
  - !ruby/object:Gem::Version
97
+ hash: 3
91
98
  segments:
92
99
  - 0
93
100
  version: "0"
94
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
95
103
  requirements:
96
104
  - - ">="
97
105
  - !ruby/object:Gem::Version
106
+ hash: 3
98
107
  segments:
99
108
  - 0
100
109
  version: "0"
101
110
  requirements: []
102
111
 
103
112
  rubyforge_project:
104
- rubygems_version: 1.3.6
113
+ rubygems_version: 1.5.0
105
114
  signing_key:
106
115
  specification_version: 3
107
116
  summary: Client library for Windows Azure's Storage Service REST API