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.
48 49 50 51 |
# File 'lib/truelayer-signing/utils.rb', line 48 def initialize(args = {}) @method = "POST" @headers = {} end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
46 47 48 |
# File 'lib/truelayer-signing/utils.rb', line 46 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
46 47 48 |
# File 'lib/truelayer-signing/utils.rb', line 46 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
46 47 48 |
# File 'lib/truelayer-signing/utils.rb', line 46 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
46 47 48 |
# File 'lib/truelayer-signing/utils.rb', line 46 def path @path end |
Instance Method Details
#add_header(name, value) ⇒ Object
67 68 69 70 71 |
# File 'lib/truelayer-signing/utils.rb', line 67 def add_header(name, value) @headers[name.to_s] = value self end |
#set_body(body) ⇒ Object
79 80 81 82 83 |
# File 'lib/truelayer-signing/utils.rb', line 79 def set_body(body) @body = body self end |
#set_headers(headers) ⇒ Object
73 74 75 76 77 |
# File 'lib/truelayer-signing/utils.rb', line 73 def set_headers(headers) headers.each { |name, value| @headers[name.to_s] = value } self end |
#set_method(method) ⇒ Object
53 54 55 56 57 |
# File 'lib/truelayer-signing/utils.rb', line 53 def set_method(method) @method = method.to_s.upcase self end |
#set_path(path) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/truelayer-signing/utils.rb', line 59 def set_path(path) raise(Error, "Path must start with '/'") unless path.start_with?("/") @path = path self end |