Class: Uploadcare::SignedUrlGenerators::BaseGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/uploadcare/signed_url_generators/base_generator.rb

Overview

Base class for signed URL generators.

Direct Known Subclasses

AkamaiGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cdn_host:, secret_key:, ttl: 300, algorithm: 'sha256') ⇒ BaseGenerator

Returns a new instance of BaseGenerator.



8
9
10
11
12
13
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 8

def initialize(cdn_host:, secret_key:, ttl: 300, algorithm: 'sha256')
  @ttl = ttl
  @algorithm = algorithm
  @cdn_host = cdn_host
  @secret_key = secret_key
end

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



5
6
7
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 5

def algorithm
  @algorithm
end

#cdn_hostObject

Returns the value of attribute cdn_host.



5
6
7
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 5

def cdn_host
  @cdn_host
end

#secret_keyObject (readonly)

Returns the value of attribute secret_key.



6
7
8
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 6

def secret_key
  @secret_key
end

#ttlObject

Returns the value of attribute ttl.



5
6
7
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 5

def ttl
  @ttl
end

Instance Method Details

#generate_urlString

Generate a signed URL.

Returns:

  • (String)

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/uploadcare/signed_url_generators/base_generator.rb', line 18

def generate_url
  raise NotImplementedError, "#{__method__} method not present"
end