Class: Miasma::Contrib::AwsApiCore::Signature
- Inherits:
-
Object
- Object
- Miasma::Contrib::AwsApiCore::Signature
- Defined in:
- lib/miasma/contrib/aws.rb
Overview
Base signature class
Direct Known Subclasses
Instance Method Summary collapse
-
#generate(http_method, path, opts = {}) ⇒ String
Generate the signature.
-
#initialize(*args) ⇒ Signature
constructor
Create new instance.
-
#safe_escape(string) ⇒ String
URL string escape compatible with AWS requirements.
Constructor Details
#initialize(*args) ⇒ Signature
Create new instance
107 108 109 |
# File 'lib/miasma/contrib/aws.rb', line 107 def initialize(*args) raise NotImplementedError.new 'This class should not be used directly!' end |
Instance Method Details
#generate(http_method, path, opts = {}) ⇒ String
Generate the signature
117 118 119 |
# File 'lib/miasma/contrib/aws.rb', line 117 def generate(http_method, path, opts={}) raise NotImplementedError end |
#safe_escape(string) ⇒ String
URL string escape compatible with AWS requirements
125 126 127 128 129 |
# File 'lib/miasma/contrib/aws.rb', line 125 def safe_escape(string) string.to_s.gsub(/([^a-zA-Z0-9_.\-~])/) do '%' << $1.unpack('H2' * $1.bytesize).join('%').upcase end end |