class Miasma::Contrib::AwsApiCore::Signature

Base signature class

Public Class Methods

new(*args) click to toggle source

Create new instance

# File lib/miasma/contrib/aws.rb, line 132
def initialize(*args)
  raise NotImplementedError, "This class should not be used directly!"
end

Public Instance Methods

generate(http_method, path, opts = {}) click to toggle source

Generate the signature

@param http_method [Symbol] HTTP request method @param path [String] request path @param opts [Hash] request options @return [String] signature

# File lib/miasma/contrib/aws.rb, line 142
def generate(http_method, path, opts = {})
  raise NotImplementedError
end
safe_escape(string) click to toggle source

URL string escape compatible with AWS requirements

@param string [String] string to escape @return [String] escaped string

# File lib/miasma/contrib/aws.rb, line 150
def safe_escape(string)
  string.to_s.gsub(/([^a-zA-Z0-9_.\-~])/) do |match|
    "%" << match.unpack("H2" * match.bytesize).join("%").upcase
  end
end