Class: Lyrebird::Response
- Inherits:
-
Object
- Object
- Lyrebird::Response
- Defined in:
- lib/lyrebird/response.rb
Class Method Summary collapse
Instance Method Summary collapse
- #document ⇒ Object
-
#initialize(issuer: DEFAULTS.issuer, destination: DEFAULTS.recipient, in_response_to: DEFAULTS.in_response_to, sign_with: nil, encrypt_with: nil, **assertion_options) ⇒ Response
constructor
A new instance of Response.
- #mimic ⇒ Object
Constructor Details
#initialize(issuer: DEFAULTS.issuer, destination: DEFAULTS.recipient, in_response_to: DEFAULTS.in_response_to, sign_with: nil, encrypt_with: nil, **assertion_options) ⇒ Response
Returns a new instance of Response.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lyrebird/response.rb', line 16 def initialize( issuer: DEFAULTS.issuer, destination: DEFAULTS.recipient, in_response_to: DEFAULTS.in_response_to, sign_with: nil, encrypt_with: nil, ** ) @issuer = issuer @destination = destination @in_response_to = in_response_to @sign_with = sign_with @encrypt_with = encrypt_with @assertion = Assertion.new( issuer: issuer, in_response_to: in_response_to, ** ) end |
Class Method Details
.build(**kwargs) {|config| ... } ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/lyrebird/response.rb', line 5 def self.build(**kwargs) config = OpenStruct.new(kwargs) config.define_singleton_method(:attributes) do |&block| self.attributes = OpenStruct.new.tap(&block).to_h end yield config if block_given? new(**config.to_h) end |
Instance Method Details
#document ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/lyrebird/response.rb', line 41 def document @document ||= Nokogiri::XML::Document.new.tap do |doc| doc.root = build_response(doc) sign_assertion(doc) if @sign_with && !@encrypt_with sign_response(doc) if @sign_with end end |
#mimic ⇒ Object
37 38 39 |
# File 'lib/lyrebird/response.rb', line 37 def mimic Base64.strict_encode64(document.to_xml(save_with: 0)) end |