Class: Linzer::HTTP::SignatureFeature
- Inherits:
-
HTTP::Feature
- Object
- HTTP::Feature
- Linzer::HTTP::SignatureFeature
- Defined in:
- lib/linzer/http/signature_feature.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #default_covered_components ⇒ Object (also: #default_components)
-
#initialize(key:, params: {}, covered_components: default_components) ⇒ SignatureFeature
constructor
A new instance of SignatureFeature.
- #wrap_request(request) ⇒ Object
Constructor Details
#initialize(key:, params: {}, covered_components: default_components) ⇒ SignatureFeature
Returns a new instance of SignatureFeature.
19 20 21 22 23 |
# File 'lib/linzer/http/signature_feature.rb', line 19 def initialize(key:, params: {}, covered_components: default_components) @fields = Array(covered_components) @key = validate_key(key) @params = Hash(params) end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
25 26 27 |
# File 'lib/linzer/http/signature_feature.rb', line 25 def fields @fields end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
25 26 27 |
# File 'lib/linzer/http/signature_feature.rb', line 25 def params @params end |
Instance Method Details
#default_covered_components ⇒ Object Also known as: default_components
34 35 36 |
# File 'lib/linzer/http/signature_feature.rb', line 34 def default_covered_components Linzer::Options::DEFAULT[:covered_components] end |
#wrap_request(request) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/linzer/http/signature_feature.rb', line 27 def wrap_request(request) = Linzer::Message.new(request) signature = Linzer.sign(key, , fields, **params) request.headers.merge!(signature.to_h) request end |