Class: TrueLayerSigning::JwsHeader
- Inherits:
-
Object
- Object
- TrueLayerSigning::JwsHeader
- Defined in:
- lib/truelayer-signing/utils.rb
Instance Attribute Summary collapse
-
#alg ⇒ Object
readonly
Returns the value of attribute alg.
-
#jku ⇒ Object
readonly
Returns the value of attribute jku.
-
#kid ⇒ Object
readonly
Returns the value of attribute kid.
-
#tl_headers ⇒ Object
readonly
Returns the value of attribute tl_headers.
-
#tl_version ⇒ Object
readonly
Returns the value of attribute tl_version.
Instance Method Summary collapse
- #filter_headers(headers) ⇒ Object
-
#initialize(args = {}) ⇒ JwsHeader
constructor
A new instance of JwsHeader.
- #to_h ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ JwsHeader
Returns a new instance of JwsHeader.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/truelayer-signing/utils.rb', line 17 def initialize(args = {}) raise(Error, "TRUELAYER_SIGNING_CERTIFICATE_ID is missing") \ if TrueLayerSigning.certificate_id.nil? || TrueLayerSigning.certificate_id.empty? @alg = args[:alg] || TrueLayerSigning.algorithm @kid = args[:kid] || TrueLayerSigning.certificate_id @tl_version = TrueLayerSigning.version @tl_headers = retrieve_headers(args[:tl_headers]) @jku = args[:jku] || nil end |
Instance Attribute Details
#alg ⇒ Object (readonly)
Returns the value of attribute alg.
15 16 17 |
# File 'lib/truelayer-signing/utils.rb', line 15 def alg @alg end |
#jku ⇒ Object (readonly)
Returns the value of attribute jku.
15 16 17 |
# File 'lib/truelayer-signing/utils.rb', line 15 def jku @jku end |
#kid ⇒ Object (readonly)
Returns the value of attribute kid.
15 16 17 |
# File 'lib/truelayer-signing/utils.rb', line 15 def kid @kid end |
#tl_headers ⇒ Object (readonly)
Returns the value of attribute tl_headers.
15 16 17 |
# File 'lib/truelayer-signing/utils.rb', line 15 def tl_headers @tl_headers end |
#tl_version ⇒ Object (readonly)
Returns the value of attribute tl_version.
15 16 17 |
# File 'lib/truelayer-signing/utils.rb', line 15 def tl_version @tl_version end |
Instance Method Details
#filter_headers(headers) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/truelayer-signing/utils.rb', line 34 def filter_headers(headers) required_header_keys = tl_headers.split(",").reject(&:empty?) normalised_headers = Utils.normalise_headers!(headers) ordered_headers = validate_declared_headers!(required_header_keys, normalised_headers) ordered_headers.to_h end |
#to_h ⇒ Object
28 29 30 31 32 |
# File 'lib/truelayer-signing/utils.rb', line 28 def to_h hash = instance_variables.to_h { |var| [var[1..].to_sym, instance_variable_get(var)] } hash.reject { |key, _value| hash[key].nil? } end |