selfsdk 0.0.222 → 0.0.223

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 708722b6e06344f8c3a9ef0d2feb3cff8efd5b13c0a6cfd314830274304d037e
4
- data.tar.gz: 7e07d7015c6fa85bde3b0b507a187b3d7a369e57135c1e3a3ad10b7566840a22
3
+ metadata.gz: e01c4dae273f3546f383e210f31b66d75a1d8b3154805e943a4f90ce8ff51f2b
4
+ data.tar.gz: f9081aaeb82f33f593c635c83a64ab00dd2ea0f1e12a1f1e0ebded73e3d690cd
5
5
  SHA512:
6
- metadata.gz: fd6167c9859227703e4cfc3d672b5f9f46e2fc5799be44b783866b476fd89cb4252015da8a12760e57fa530611fddc2cd485932f173be8b098e0dd7eccb397df
7
- data.tar.gz: 5916e6b83b862282cd0483f99dc21fb59cb7226bf1049adbf71a3446b1480f4e6aee4478ab7d5ad07e71c693f1b4897e07f58ea6525b4c0b59436a12aa7d994c
6
+ metadata.gz: 3f42df63fda36b70919f5a23db332d39dd886225bbbdb6fe28dece6f8fb6581b3ea286f7e1e8ebca194a579ffe50049bee7fe18425f21ad712ab6ffc4787fb34
7
+ data.tar.gz: c6fb329eb380e739963d94fa5e244bdd03c0d8207d4551f82fbe556a79fca94d1cc36838765ca3358700bc73caa33b963448f605d5c94843d35ea9e2f4a875cb
@@ -0,0 +1,31 @@
1
+ # Copyright 2020 Self Group Ltd. All Rights Reserved.
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'self_msgproto'
6
+ require_relative 'base'
7
+ require_relative '../ntptime'
8
+
9
+ module SelfSDK
10
+ module Messages
11
+ class Generic < Base
12
+ def parse(input, envelope=nil)
13
+ @input = input
14
+ @payload = get_payload input
15
+ @id = @payload[:jti]
16
+ @from = @payload[:iss]
17
+ @to = @payload[:sub]
18
+ @audience = payload[:aud]
19
+ @expires = @payload[:exp]
20
+ @typ = @payload[:typ]
21
+ @body = @payload[:msg]
22
+
23
+ if envelope
24
+ issuer = envelope.sender.split(":")
25
+ @from = issuer.first
26
+ @from_device = issuer.last
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -18,12 +18,13 @@ require_relative "voice_busy"
18
18
  require_relative "voice_summary"
19
19
  require_relative "document_sign_resp"
20
20
  require_relative "connection_response"
21
+ require_relative "generic"
21
22
 
22
23
  module SelfSDK
23
24
  module Messages
24
25
  class UnmappedMessage < StandardError
25
26
  end
26
-
27
+
27
28
  def self.parse(input, messaging, original=nil)
28
29
  envelope = nil
29
30
  body = if input.is_a? String
@@ -87,7 +88,8 @@ module SelfSDK
87
88
  m = VoiceSummary.new(messaging)
88
89
  m.parse(body, envelope)
89
90
  else
90
- raise UnmappedMessage.new("Invalid message type #{payload[:typ]}.")
91
+ m = Generic.new(messaging)
92
+ m.parse(body, envelope)
91
93
  end
92
94
  return m
93
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.222
4
+ version: 0.0.223
5
5
  platform: ruby
6
6
  authors:
7
7
  - Self Group Ltd.
@@ -388,6 +388,7 @@ files:
388
388
  - lib/messages/fact_issue.rb
389
389
  - lib/messages/fact_request.rb
390
390
  - lib/messages/fact_response.rb
391
+ - lib/messages/generic.rb
391
392
  - lib/messages/message.rb
392
393
  - lib/messages/voice_accept.rb
393
394
  - lib/messages/voice_busy.rb