Class: Azure::SAS::CanonicalizedResource

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/sas/canonicalized_resource.rb

Instance Method Summary collapse

Constructor Details

#initialize(storage_account, uri, blob: true) ⇒ CanonicalizedResource

Returns a new instance of CanonicalizedResource.



7
8
9
10
11
# File 'lib/azure/sas/canonicalized_resource.rb', line 7

def initialize(, uri, blob: true)
  @storage_account = 
  @uri = Addressable::URI.parse(uri)
  @blob = blob
end

Instance Method Details

#generateObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/azure/sas/canonicalized_resource.rb', line 13

def generate
  path = URI.unescape(@uri.path.to_s)

  resource =
    if @blob
      [@storage_account, *path.split('/')]
    else
      [@storage_account, path.split('/')[0]]
    end

  File.join('/', *resource)
end