Class: IB::IncomingMessages::Error

Inherits:
AbstractMessage show all
Defined in:
lib/ib-ruby/messages.rb

Instance Attribute Summary

Attributes inherited from AbstractMessage

#data

Attributes inherited from ExtremelyAbstractMessage

#created_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractMessage

inherited, #initialize

Constructor Details

This class inherits a constructor from IB::IncomingMessages::AbstractMessage

Class Method Details

.message_idObject



1002
1003
1004
# File 'lib/ib-ruby/messages.rb', line 1002

def self.message_id
  4
end

Instance Method Details

#codeObject



1006
1007
1008
# File 'lib/ib-ruby/messages.rb', line 1006

def code
  @data && @data[:code]
end

#loadObject



1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'lib/ib-ruby/messages.rb', line 1010

def load
  @data[:version] = @socket.read_int

  if @data[:version] < 2
    @data[:message] = @socket.read_string
  else
    autoload([:id, :int], [:code, :int], [:message, :string])
  end
end

#to_humanObject



1020
1021
1022
# File 'lib/ib-ruby/messages.rb', line 1020

def to_human
  "TWS #{@data[:code]}: #{@data[:message]}"
end