Class: Dtn::Messages::System::Generic

Inherits:
Dtn::Message
  • Object
show all
Defined in:
lib/dtn/messages/system/generic.rb

Overview

Atm we return all system messages class or give it bask as a plain text if it does not know it

Defined Under Namespace

Classes: AllUpdateFieldnames, AutoconnectOff, AutoconnectOn, Connected, CurrentLoginid, CurrentPassword, CurrentProtocol, CurrentUpdateFieldnames, Disconnected, FundamentalFieldnames, Ip, LoginInfoNotSaved, LoginInfoSaved, Obsolete, ReconnectionFailed, RegisterClientApp, RemoveClientApp, ReplacedPreviousWatch, SymbolLimitReached, Watches

Class Method Summary collapse

Methods inherited from Dtn::Message

callback_name, #callback_name

Class Method Details

.parse(line:, client:) ⇒ Object

rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/dtn/messages/system/generic.rb', line 65

def parse(line:, client:, **)
  case line
  when /^S,KEY/ then Obsolete.new
  when /^S,SERVER CONNECTED/ then Connected.new
  when /^S,SERVER DISCONNECTED/ then Disconnected.new
  when /^S,SERVER RECONNECT FAILED/ then ReconnectionFailed.new
  when /^S,SYMBOL LIMIT REACHED/ then SymbolLimitReached.new
  when /^S,CURRENT PROTOCOL,/ then CurrentProtocol.parse(line: line[19..])
  when /^S,IP,/ then Ip.parse(line: line[5..])
  when /^S,CUST,/ then CustomerInfo.parse(line: line[7..])
  when /^S,FUNDAMENTAL FIELDNAMES,/ then FundamentalFieldnames.parse(line: line[25..])
  when /^S,UPDATE FIELDNAMES,/ then AllUpdateFieldnames.parse(line: line[20..])
  when /^S,CURRENT UPDATE FIELDNAMES,/ then CurrentUpdateFieldnames.parse(line: line[28..], client: client)
  when /^S,WATCHES/ then Watches.parse(line: line[10..])
  when /^S,REPLACED PREVIOUS WATCH/ then ReplacedPreviousWatch.parse(line: line[25..])
  when /^S,REGISTER CLIENT APP COMPLETED/ then RegisterClientApp.parse(line: line[31..])
  when /^S,REMOVE CLIENT APP COMPLETED/ then RemoveClientApp.parse(line: line[29..])
  when /^S,CURRENT LOGINID/ then CurrentLoginid.parse(line: line[17..])
  when /^S,CURRENT PASSWORD/ then CurrentPassword.parse(line: line[18..])
  when /^S,LOGIN INFO SAVED/ then LoginInfoSaved.parse(line: line[18..])
  when /^S,LOGIN INFO NOT SAVED/ then LoginInfoNotSaved.parse(line: line[22..])
  when /^S,AUTOCONNECT ON/ then AutoconnectOn.parse(line: line[16..])
  when /^S,AUTOCONNECT OFF/ then AutoconnectOff.parse(line: line[17..])
  when /^S,CLIENTSTATS/ then ClientStats.parse(line: line[13..])
  when /^S,STATS/ then Stats.parse(line: line[8..])
  else new(line: line[2..])
  end
end