Class: Net::HTTP::Signature
- Inherits:
-
Object
- Object
- Net::HTTP::Signature
- Defined in:
- lib/net/http/signature.rb,
lib/net/http/signature/signer.rb,
lib/net/http/signature/request.rb,
lib/net/http/signature/version.rb
Defined Under Namespace
Constant Summary collapse
- HEADER =
"Signature"
- VERSION =
"1.0.1"
Instance Method Summary collapse
-
#initialize(key:, signer:) ⇒ Signature
constructor
A new instance of Signature.
- #to_h ⇒ Object
- #to_s ⇒ Object
- #valid?(string) ⇒ Boolean
Constructor Details
#initialize(key:, signer:) ⇒ Signature
Returns a new instance of Signature.
14 15 16 17 |
# File 'lib/net/http/signature.rb', line 14 def initialize(key:, signer:) @key = key @signer = signer end |
Instance Method Details
#to_h ⇒ Object
27 28 29 30 31 |
# File 'lib/net/http/signature.rb', line 27 def to_h { HEADER => to_s } end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/net/http/signature.rb', line 23 def to_s "key=#{key} algorithm=#{algorithm} token=#{signer}" end |
#valid?(string) ⇒ Boolean
19 20 21 |
# File 'lib/net/http/signature.rb', line 19 def valid?(string) to_s.strip == string.strip end |