Class: TrueLayerSigning::JwsBase
- Inherits:
-
Object
- Object
- TrueLayerSigning::JwsBase
- Defined in:
- lib/truelayer-signing/utils.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_header(name, value) ⇒ Object
-
#initialize(_args = {}) ⇒ JwsBase
constructor
A new instance of JwsBase.
- #set_body(body) ⇒ Object
- #set_headers(headers) ⇒ Object
- #set_method(method) ⇒ Object
- #set_path(path) ⇒ Object
Constructor Details
#initialize(_args = {}) ⇒ JwsBase
Returns a new instance of JwsBase.
62 63 64 65 |
# File 'lib/truelayer-signing/utils.rb', line 62 def initialize(_args = {}) @method = "POST" @headers = {} end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
60 61 62 |
# File 'lib/truelayer-signing/utils.rb', line 60 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
60 61 62 |
# File 'lib/truelayer-signing/utils.rb', line 60 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
60 61 62 |
# File 'lib/truelayer-signing/utils.rb', line 60 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
60 61 62 |
# File 'lib/truelayer-signing/utils.rb', line 60 def path @path end |
Instance Method Details
#add_header(name, value) ⇒ Object
81 82 83 84 85 |
# File 'lib/truelayer-signing/utils.rb', line 81 def add_header(name, value) @headers[name.to_s] = value self end |
#set_body(body) ⇒ Object
93 94 95 96 97 |
# File 'lib/truelayer-signing/utils.rb', line 93 def set_body(body) @body = body self end |
#set_headers(headers) ⇒ Object
87 88 89 90 91 |
# File 'lib/truelayer-signing/utils.rb', line 87 def set_headers(headers) headers.each { |name, value| @headers[name.to_s] = value } self end |
#set_method(method) ⇒ Object
67 68 69 70 71 |
# File 'lib/truelayer-signing/utils.rb', line 67 def set_method(method) @method = method.to_s.upcase self end |
#set_path(path) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/truelayer-signing/utils.rb', line 73 def set_path(path) raise(Error, "Path must start with '/'") unless path.start_with?("/") @path = path self end |