fix-protocol 1.1.0 → 1.1.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0beed30259b1a1ac0e530e0b4a96ac0329e5ab
|
4
|
+
data.tar.gz: cb85ffdeb3c76826ad078091219ecbbd22e796cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 620109d57d076bc3ccac65e8edfe1ec96db7e0cc01e048458d495fbb0f69503273148910fa9240eb352e39c7dc8f1d48468a581dba614b63e2480606a99fffbd
|
7
|
+
data.tar.gz: fcce3d4785f25e28e4f962c27e525e4a7d803109448265cfb41383bcf2d1a24533beca16c002e536ade01940d3f17feb9ec2aa74a97c7a37919736c0ebe34437
|
data/lib/fix/protocol.rb
CHANGED
@@ -41,8 +41,9 @@ module Fix
|
|
41
41
|
|
42
42
|
# Check checksum
|
43
43
|
checksum = str.match(/10\=([^\x01]+)\x01/)[1]
|
44
|
-
|
45
|
-
|
44
|
+
expected = ('%03d' % (str.gsub(/10\=[^\x01]+\x01/, '').bytes.inject(&:+) % 256))
|
45
|
+
if checksum != expected
|
46
|
+
errors << "Incorrect checksum, expected <#{expected}>, got <#{checksum}>"
|
46
47
|
end
|
47
48
|
|
48
49
|
if errors.empty?
|
data/lib/fix/protocol/message.rb
CHANGED
@@ -10,8 +10,16 @@ module Fix
|
|
10
10
|
#
|
11
11
|
class Message < MessagePart
|
12
12
|
|
13
|
+
# Default version for when we do not specify anything
|
14
|
+
DEFAULT_VERSION = 'FIX.4.4'
|
15
|
+
@@expected_version = DEFAULT_VERSION
|
16
|
+
|
17
|
+
def self.version=(v)
|
18
|
+
@@expected_version = v
|
19
|
+
end
|
20
|
+
|
13
21
|
part :header do
|
14
|
-
field :version, tag: 8, required: true, default:
|
22
|
+
field :version, tag: 8, required: true, default: @@expected_version
|
15
23
|
field :body_length, tag: 9
|
16
24
|
|
17
25
|
unordered :header_fields do
|
@@ -58,10 +66,10 @@ module Fix
|
|
58
66
|
# @return [Array<String>] The errors on the message header
|
59
67
|
#
|
60
68
|
def errors
|
61
|
-
if (version ==
|
69
|
+
if (version == @@expected_version)
|
62
70
|
super
|
63
71
|
else
|
64
|
-
[super, "Unsupported version: <#{version}>"].flatten
|
72
|
+
[super, "Unsupported version: <#{version}>, expected <#{@@expected_version}>"].flatten
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
@@ -19,7 +19,7 @@ module Fix
|
|
19
19
|
#
|
20
20
|
def errors
|
21
21
|
e = []
|
22
|
-
e << "EndSeqNo must either be 0 (inifinity) or be >= BeginSeqNo" unless (end_seq_no.zero? || (end_seq_no >= begin_seq_no))
|
22
|
+
e << "EndSeqNo must either be 0 (inifinity) or be >= BeginSeqNo" unless (begin_seq_no && (end_seq_no.zero? || (end_seq_no >= begin_seq_no)))
|
23
23
|
[super, e].flatten
|
24
24
|
end
|
25
25
|
|
data/lib/fix/protocol/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fix-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David François
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|