Class: Uploadcare::Param::AuthenticationHeader
- Inherits:
-
Object
- Object
- Uploadcare::Param::AuthenticationHeader
- Defined in:
- lib/uploadcare/param/authentication_header.rb
Overview
This object returns headers needed for authentication This authentication method is more secure, but more tedious
Class Method Summary collapse
- .call(options = {}) ⇒ Object
-
.is_blank?(value) ⇒ Boolean
rubocop:disable Naming/PredicateName.
- .validate_auth_config ⇒ Object
Class Method Details
.call(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/uploadcare/param/authentication_header.rb', line 13 def self.call( = {}) validate_auth_config case Uploadcare.config.auth_type when 'Uploadcare' SecureAuthHeader.call() when 'Uploadcare.Simple' SimpleAuthHeader.call else raise ArgumentError, "Unknown auth_scheme: '#{Uploadcare.config.auth_type}'" end end |
.is_blank?(value) ⇒ Boolean
rubocop:disable Naming/PredicateName
31 32 33 |
# File 'lib/uploadcare/param/authentication_header.rb', line 31 def self.is_blank?(value) value.nil? || value.empty? end |
.validate_auth_config ⇒ Object
25 26 27 28 |
# File 'lib/uploadcare/param/authentication_header.rb', line 25 def self.validate_auth_config raise Uploadcare::Exception::AuthError, 'Public Key is blank.' if is_blank?(Uploadcare.config.public_key) raise Uploadcare::Exception::AuthError, 'Secret Key is blank.' if is_blank?(Uploadcare.config.secret_key) end |