Class: Bosh::Blobstore::Sha1VerifiableBlobstoreClient
- Inherits:
-
BaseClient
- Object
- Client
- BaseClient
- Bosh::Blobstore::Sha1VerifiableBlobstoreClient
- Extended by:
- Forwardable
- Defined in:
- lib/blobstore_client/sha1_verifiable_blobstore_client.rb
Constant Summary
Constants inherited from Client
Client::PROVIDER_NAMES, Client::VERSION
Instance Method Summary collapse
- #get(id, file = nil, options = {}) ⇒ Object
-
#initialize(client) ⇒ Sha1VerifiableBlobstoreClient
constructor
A new instance of Sha1VerifiableBlobstoreClient.
Methods inherited from BaseClient
Methods inherited from Client
Constructor Details
#initialize(client) ⇒ Sha1VerifiableBlobstoreClient
Returns a new instance of Sha1VerifiableBlobstoreClient.
9 10 11 |
# File 'lib/blobstore_client/sha1_verifiable_blobstore_client.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#get(id, file = nil, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/blobstore_client/sha1_verifiable_blobstore_client.rb', line 13 def get(id, file = nil, = {}) if .has_key?(:sha1) expected_sha1 = [:sha1] raise ArgumentError, 'sha1 must not be nil' unless expected_sha1 end result_file = @client.get(id, file, ) if expected_sha1 # Blobstore clients either modify passed in file # or return new temporary file check_sha1(expected_sha1, file || result_file) end result_file end |