azure-storage 0.10.1.preview → 0.10.2.preview

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: 68f699e6dbd6ceed52d8c35694a78d9c852ea5a0
4
- data.tar.gz: 21e079f0fab409af5260dd228e1a3ec7e05d180c
3
+ metadata.gz: 31054294abe6fc2b3f0dcb87d286291e9dfe0766
4
+ data.tar.gz: 0d4555ce667aabb5dfd2f1d49d7d28b09ff0bd7b
5
5
  SHA512:
6
- metadata.gz: c15b3eb7927d1856e98f0a36cfd543885d5bfedc6d4986d01147a234f0b016169683a66974126aa1b22bf9341547ad6f89708c4b848526d128666c5222433701
7
- data.tar.gz: 4f9cf1548ad8e0761671dfba0835a71367544e3018c02b06b44ccd185af42ff0056a181f029aa291a8c79fe4e6b555a227cc85ca882618b1a0777873f4cc8caa
6
+ metadata.gz: b3bdddb9899c6ad7f4680a8350b6351ddcf4a7ae29dace4cd1daf5ca27053a19e1503881b521ac364d08be1b6c5b1b97c275378e12dd5655c00b020a2d6077ef
7
+ data.tar.gz: a473487c90bad59cac0a335e3d58df1405da2c70ee816cf717295f0ae09cf4061e0fb2789dc46da37e7fc9ddab529047b5bd0d0f1e9ffa35d93f6d4d4680147a
data/lib/azure/storage.rb CHANGED
@@ -40,7 +40,7 @@ module Azure
40
40
  include Azure::Storage::Configurable
41
41
 
42
42
  def client(options={})
43
- @client = Azure::Storage::Client.new(options)
43
+ @client = Azure::Storage::Client.new(options) unless defined?(@client) && @client.same_options?(options)
44
44
  @client
45
45
  end
46
46
 
@@ -53,6 +53,4 @@ module Azure
53
53
 
54
54
  end
55
55
  end
56
-
57
- Azure::Storage.setup
58
- end
56
+ end
@@ -417,7 +417,7 @@ module Azure::Storage
417
417
  protected
418
418
  def containers_uri(query={})
419
419
  query = { 'comp' => 'list' }.merge(query)
420
- generate_uri('/', query)
420
+ generate_uri('', query)
421
421
  end
422
422
 
423
423
  # Protected: Generate the URI for a specific container.
@@ -47,7 +47,7 @@ module Azure::Storage
47
47
  #
48
48
  # Accepted key/value pairs in options parameter are:
49
49
  #
50
- # * +:use_development_storage+ - TrueClass. Whether to use storage emulator.
50
+ # * +:use_development_storage+ - True. Whether to use storage emulator.
51
51
  # * +:development_storage_proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
52
52
  # * +:storage_account_name+ - String. The name of the storage account.
53
53
  # * +:storage_access_key+ - Base64 String. The access key of the storage account.
@@ -77,6 +77,11 @@ module Azure::Storage
77
77
  #
78
78
  # @return [Azure::Storage::Client]
79
79
  def initialize(options = {})
80
+ if options.is_a?(Hash)
81
+ options = setup_options if options.length == 0
82
+ options = parse_connection_string(options[:storage_connection_string]) if options[:storage_connection_string]
83
+ end
84
+
80
85
  reset!(options)
81
86
  end
82
87
 
@@ -80,6 +80,11 @@ module Azure::Storage
80
80
  self
81
81
  end
82
82
 
83
+ # Check if this client is configured with the same options
84
+ def same_options?(opts)
85
+ opts.length == 0 || opts.hash == options.hash
86
+ end
87
+
83
88
  # The options after validated and normalized
84
89
  #
85
90
  # @return [Hash]
@@ -147,11 +152,6 @@ module Azure::Storage
147
152
 
148
153
  private
149
154
 
150
- # Check if this client is configured with the same options
151
- def same_options?(opts)
152
- opts.hash == input.hash
153
- end
154
-
155
155
  def method_missing(method_name)
156
156
  return super unless options.key? method_name
157
157
  options[method_name]
@@ -230,7 +230,7 @@ module Azure::Storage
230
230
  rescue InvalidOptionsError => e
231
231
  end
232
232
 
233
- raise InvalidOptionsError,"options provided are not valid set: #{options}" # wrong opts if move to this line
233
+ raise InvalidOptionsError,"options provided are not valid set: #{opts}" # wrong opts if move to this line
234
234
  end
235
235
 
236
236
  def normalize_hosts(options)
@@ -293,6 +293,7 @@ module Azure::Storage
293
293
 
294
294
  valid_options = required + at_least_one + only_one + optional
295
295
  results = {}
296
+
296
297
  opts.each do |k,v|
297
298
  raise InvalidOptionsError,"#{k} is not included in valid options" unless valid_options.length == 0 || valid_options.include?(k)
298
299
  unless @@option_validators.key?(k) && @@option_validators[k].call(v)
@@ -22,6 +22,8 @@
22
22
  # THE SOFTWARE.
23
23
  #--------------------------------------------------------------------------
24
24
 
25
+ require 'azure/storage/core'
26
+
25
27
  module Azure::Storage
26
28
 
27
29
  class InvalidConnectionStringError < Core::StorageError
@@ -126,11 +126,15 @@ module Azure::Storage
126
126
  private
127
127
 
128
128
  def default_host(service)
129
- "https://#{storage_account_name}.#{service}.core.windows.net"
129
+ "https://#{storage_account_name}.#{service}.core.windows.net" if storage_account_name
130
130
  end
131
131
 
132
- def options
133
- Hash[Azure::Storage::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }]
132
+ def setup_options
133
+ opts = {}
134
+ Azure::Storage::Configurable.keys.map do |key|
135
+ opts[key] = Azure::Storage.send(key) if Azure::Storage.send(key)
136
+ end
137
+ opts
134
138
  end
135
139
 
136
140
  end
@@ -28,7 +28,7 @@ require 'azure/storage/version'
28
28
  module Azure::Storage
29
29
  module Default
30
30
  # Default REST service (STG) version number
31
- STG_VERSION = '2015-02-21'
31
+ STG_VERSION = '2015-04-05'
32
32
 
33
33
  # The number of default concurrent requests for parallel operation.
34
34
  DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
@@ -85,6 +85,24 @@ module Azure::Storage
85
85
  query.update(restype: 'service', comp: 'properties')
86
86
  generate_uri('', query)
87
87
  end
88
+
89
+ # Overrides the base class implementation to determine the request uri
90
+ #
91
+ # path - String. the request path
92
+ # query - Hash. the query parameters
93
+ #
94
+ # Returns the uri hash
95
+ def generate_uri(path='', query={})
96
+ if self.client.is_a?(Azure::Storage::Client) && self.client.options[:use_path_style_uri]
97
+ if path.length > 0
98
+ path = self.client.options[:storage_account_name] + '/' + path
99
+ else
100
+ path = self.client.options[:storage_account_name]
101
+ end
102
+ end
103
+
104
+ super path, query
105
+ end
88
106
 
89
107
  class << self
90
108
  # Adds metadata properties to header hash with required prefix
@@ -133,4 +151,4 @@ module Azure::Storage
133
151
 
134
152
  end
135
153
  end
136
- end
154
+ end
@@ -43,4 +43,4 @@ module Azure::Storage
43
43
  attr_accessor :default_service_version
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -28,7 +28,7 @@ module Azure
28
28
  # Fields represent the parts defined in http://semver.org/
29
29
  MAJOR = 0 unless defined? MAJOR
30
30
  MINOR = 10 unless defined? MINOR
31
- UPDATE = 1 unless defined? UPDATE
31
+ UPDATE = 2 unless defined? UPDATE
32
32
  PRE = 'preview' unless defined? PRE
33
33
 
34
34
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1.preview
4
+ version: 0.10.2.preview
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-05-18 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable