Class: SelfSDK::Messages::Generic
Instance Attribute Summary
Attributes inherited from Base
#description, #exp_timeout, #expires, #fields, #from, #from_device, #id, #input, #intermediary, #payload, #status, #sub, #to, #to_device, #typ
Instance Method Summary collapse
Methods inherited from Base
#accepted?, #encrypt_message, #errored?, #initialize, #rejected?, #request, #send_message, #unauthorized?, #validate!
Constructor Details
This class inherits a constructor from SelfSDK::Messages::Base
Instance Method Details
#parse(input, envelope = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/messages/generic.rb', line 12 def parse(input, envelope=nil) @input = input @payload = get_payload input @id = @payload[:jti] @from = @payload[:iss] @to = @payload[:sub] @audience = payload[:aud] @expires = @payload[:exp] @typ = @payload[:typ] @body = @payload[:msg] if envelope issuer = envelope.sender.split(":") @from = issuer.first @from_device = issuer.last end end |