Class: SebElink::Message
- Inherits:
-
Object
- Object
- SebElink::Message
- Includes:
- Communications
- Defined in:
- lib/seb_elink/message.rb
Constant Summary collapse
- SUPPORTED_VERSIONS =
["001"].freeze
- SUPPORTED_MESSAGES =
["0002"].freeze
Instance Attribute Summary collapse
-
#data_hash ⇒ Object
readonly
Returns the value of attribute data_hash.
-
#gateway_instance ⇒ Object
readonly
Returns the value of attribute gateway_instance.
-
#message_code ⇒ Object
readonly
Returns the value of attribute message_code.
Instance Method Summary collapse
- #digital_signature ⇒ Object
-
#initialize(gateway_instance, message_code, data_hash) ⇒ Message
constructor
A new instance of Message.
- #to_h ⇒ Object
Constructor Details
#initialize(gateway_instance, message_code, data_hash) ⇒ Message
Returns a new instance of Message.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/seb_elink/message.rb', line 9 def initialize(gateway_instance, , data_hash) @gateway_instance = gateway_instance @message_code = @data_hash = gateway_instance.defaults. merge(IB_SERVICE: @message_code).merge(data_hash) validate_version end |
Instance Attribute Details
#data_hash ⇒ Object (readonly)
Returns the value of attribute data_hash.
7 8 9 |
# File 'lib/seb_elink/message.rb', line 7 def data_hash @data_hash end |
#gateway_instance ⇒ Object (readonly)
Returns the value of attribute gateway_instance.
7 8 9 |
# File 'lib/seb_elink/message.rb', line 7 def gateway_instance @gateway_instance end |
#message_code ⇒ Object (readonly)
Returns the value of attribute message_code.
7 8 9 |
# File 'lib/seb_elink/message.rb', line 7 def @message_code end |
Instance Method Details
#digital_signature ⇒ Object
22 23 24 |
# File 'lib/seb_elink/message.rb', line 22 def digital_signature @digital_signature ||= to_h[:IB_CRC] end |
#to_h ⇒ Object
26 27 28 |
# File 'lib/seb_elink/message.rb', line 26 def to_h @to_h ||= send("message_#{}") end |