lib/api_signature/generator.rb in api_signature-0.1.4 vs lib/api_signature/generator.rb in api_signature-0.1.5
- old
+ new
@@ -4,14 +4,15 @@
require 'digest/sha1'
module ApiSignature
class Generator
SPLITTER = '|'
- TTL = 2.hours
delegate :valid?, :expired?, :timestamp, to: :validator
+ attr_reader :options
+
def initialize(options = {})
@options = options
end
def generate_signature(secret)
@@ -20,21 +21,21 @@
end
private
def validator
- Validator.new(@options)
+ Validator.new(options)
end
def digest
OpenSSL::Digest::SHA256.new
end
def string_to_sign
[
- @options[:request_method],
- @options[:path],
- @options[:access_key],
+ options[:request_method],
+ options[:path],
+ options[:access_key],
timestamp.to_i
].map(&:to_s).join(SPLITTER)
end
end
end