Class: TrueLayerSigning::JwsBase

Inherits:
Object
  • Object
show all
Defined in:
lib/truelayer-signing/utils.rb

Direct Known Subclasses

Signer, Verifier

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (readonly)

Returns the value of attribute body.



46
47
48
# File 'lib/truelayer-signing/utils.rb', line 46

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



46
47
48
# File 'lib/truelayer-signing/utils.rb', line 46

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



46
47
48
# File 'lib/truelayer-signing/utils.rb', line 46

def method
  @method
end

#pathObject (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

Raises:



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