Class: BitsService::Blob

Inherits:
Object
  • Object
show all
Defined in:
lib/bits_service_client/blob.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, private_endpoint:, private_http_client:, vcap_request_id:, username:, password:, resource_type:) ⇒ Blob

Returns a new instance of Blob.



7
8
9
10
11
12
13
14
15
# File 'lib/bits_service_client/blob.rb', line 7

def initialize(key:, private_endpoint:, private_http_client:, vcap_request_id:, username:, password:, resource_type:)
  @key = key
  @private_http_client = private_http_client
  @vcap_request_id = vcap_request_id
  @username = username
  @password = password
  @resource_type = resource_type
  @private_endpoint = private_endpoint
end

Instance Attribute Details

#key ⇒ Object (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/bits_service_client/blob.rb', line 5

def key
  @key
end

Instance Method Details

#attributes(*_) ⇒ Object



17
18
19
# File 'lib/bits_service_client/blob.rb', line 17

def attributes(*_)
  {}
end

#guid ⇒ Object



21
22
23
# File 'lib/bits_service_client/blob.rb', line 21

def guid
  key
end

#internal_download_url ⇒ Object



33
34
35
# File 'lib/bits_service_client/blob.rb', line 33

def internal_download_url
  generate_private_url(key)
end

#public_download_url ⇒ Object



25
26
27
# File 'lib/bits_service_client/blob.rb', line 25

def public_download_url
  signed_url(key)
end

#public_upload_url ⇒ Object



29
30
31
# File 'lib/bits_service_client/blob.rb', line 29

def public_upload_url
  signed_url(key, verb: 'put') + '&async=true'
end