fin 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -41,3 +41,8 @@
41
41
  == 0.1.5 / 2011-11-18
42
42
 
43
43
  * Datetime fields read as Integer now
44
+
45
+ == 0.1.6 / 2011-11-21
46
+
47
+ * Int64 [:i8] fields read as Variant now
48
+ * Fin::Order :local_stamp property added
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -13,8 +13,11 @@ module Fin
13
13
  :amount => :i4, # - �����, ���-�� ������ �����������
14
14
  [:id_deal, :deal_id] => :i8, # - ����� ������
15
15
  [:sess_id, :session_id] => :i4, # ������������� ������
16
- :moment => :t, # ����� ���������� ������.
17
- :pos => :i4, # ���-�� ������� �� ����������� �� ����� ����� ������.
16
+ :moment => :t, # ����� ���������� ������.
17
+ :pos => :i4, # ���-�� ������� �� ����������� �� ����� ����� ������.
18
+ :id_ord_sell => :i8, # ����� ������ ��������
19
+ :id_ord_buy => :i8, # ����� ������ ����������.
20
+
18
21
  :nosystem => :i1 # 1-������������ ������, 0-�������
19
22
 
20
23
  # Optional fields, only for repo/multileg deals:
@@ -23,7 +26,6 @@ module Fin
23
26
 
24
27
  # Optional fields, only for OWN deals:
25
28
  property :code_sell => :c7, # ��� ��������:status_sell,
26
- :id_ord_sell => :i8, # ����� ������ ��������
27
29
  :ext_id_sell => :i4, # ������� ����� �� ������ ��������
28
30
  :comment_sell => :c20, # ����������� �� ������ ��������.
29
31
  :trust_sell => :i1, # ������� �������������� ���������� �� ������ ��������
@@ -33,7 +35,6 @@ module Fin
33
35
  :login_sell => :c20, # ����� ������������ ��������
34
36
  :code_rts_sell => :c7, # ��� ��� ��������
35
37
  :code_buy => :c7, # ��� ����������
36
- :id_ord_buy => :i8, # ����� ������ ����������.
37
38
  :ext_id_buy => :i4, # ������� ����� �� ������ ����������
38
39
  :comment_buy => :c20, # ����������� �� ������ ����������
39
40
  :trust_buy => :i1, # ������� �������������� ���������� �� ������ ����������
@@ -53,7 +53,7 @@ module Fin
53
53
  when /^i[14]/
54
54
  "rec.GetValAsLong('#{name}')"
55
55
  when /^i8/
56
- "rec.GetValAsString('#{name}').to_i"
56
+ "rec.GetValAsVariant('#{name}')"
57
57
  when /^[df]/
58
58
  "rec.GetValAsString('#{name}').to_f"
59
59
  when /^[c]/
@@ -85,14 +85,14 @@ module Fin
85
85
 
86
86
  # Extracts attributes from record into a serializable format (Array)
87
87
  # Returns an Array where 1st element is a model_class_id of our Model subclass,
88
- # and second element is a list of arguments to its initialize. Class method!
88
+ # followed by a list of arguments to its initialize. Class method!
89
89
  def self.to_msg rec
90
90
  extract_attributes(rec).unshift(model_class_id)
91
91
  end
92
92
 
93
93
  # Converts OBJECT attributes into a serializable format (Array)
94
94
  # Returns an Array where 1st element is a model_class_id of our Model subclass,
95
- # and second element is a list of arguments to its initialize. Instance method!
95
+ # followed by a list of arguments to its initialize. Instance method!
96
96
  def to_msg
97
97
  inject([self.class.model_class_id]) { |array, (name, _)| array << send(name) }
98
98
  end
@@ -34,6 +34,7 @@ module Fin
34
34
  :broker_from_rts => :c7, # ��� ��� ����� - ��������� ������
35
35
  :id_deal => :i8, # ������������� ������ �� ������ ������ ������� ������
36
36
  :deal_price => :'d16.5', # ���� ����������� ������
37
+ :local_stamp => :t, # ��������� ����� ������������
37
38
  :status => :i4, # ������ ������ - ������������ ����� ������� �����:
38
39
  # o 0x01 � ������������
39
40
  # o 0x02 � ���������
@@ -43,9 +44,9 @@ module Fin
43
44
  # o 0x400000 � ������ �������� ����������� ���������� ��������
44
45
  # o 0x800000 � ������� �������� ������� ������ �� ������� �����-������
45
46
  :action => :i1 # ��������� ��������, ������������ � �������:
46
- # o 0 � ������ �������
47
- # o 1 � ������ ���������
48
- # o 2 � ������ ������� � ������
47
+ # o 0 � ������ �������
48
+ # o 1 � ������ ���������
49
+ # o 2 � ������ ������� � ������
49
50
 
50
51
  def self.index_for rec
51
52
  rec.GetValAsLong('replID')
@@ -19,54 +19,54 @@ describe Fin::Deal do
19
19
  end
20
20
 
21
21
  it '#inspect lists ALL properties' do
22
- subject.inspect.should == "replID=12,replRev=123,replAct=,isin_id=1234567,price=1234,amount=12345,id_deal=1212,sess_id=1213,moment=time,pos=121212,nosystem=0,id_deal_multileg=0,id_repo=0,code_sell=,id_ord_sell=123456,ext_id_sell=,comment_sell=,trust_sell=,status_sell=0,hedge_sell=,fee_sell=,login_sell=,code_rts_sell=,code_buy=,id_ord_buy=654321,ext_id_buy=,comment_buy=,trust_buy=,status_buy=0,hedge_buy=,fee_buy=,login_buy=,code_rts_buy="
22
+ subject.inspect.should == "replID=12,replRev=123,replAct=,isin_id=1234567,price=1234,amount=12345,id_deal=1212,sess_id=1213,moment=time,pos=121212,id_ord_sell=123456,id_ord_buy=654321,nosystem=0,id_deal_multileg=0,id_repo=0,code_sell=,ext_id_sell=,comment_sell=,trust_sell=,status_sell=0,hedge_sell=,fee_sell=,login_sell=,code_rts_sell=,code_buy=,ext_id_buy=,comment_buy=,trust_buy=,status_buy=0,hedge_buy=,fee_buy=,login_buy=,code_rts_buy="
23
23
  end
24
- end
25
24
 
26
- describe '#index' do
27
- it 'should be equal to deal_id' do
28
- subject.index.should == subject.deal_id
25
+ describe '#index' do
26
+ it 'should be equal to deal_id' do
27
+ subject.index.should == subject.deal_id
28
+ end
29
29
  end
30
30
  end
31
- end
32
31
 
33
- describe '#new with empty initializer' do
34
- let(:property_hash) { {} }
35
- subject { Fin::Deal.new }
32
+ describe '#new with empty initializer' do
33
+ let(:property_hash) { {} }
34
+ subject { Fin::Deal.new }
36
35
 
37
- it_behaves_like 'model'
36
+ it_behaves_like 'model'
38
37
 
39
- it 'has all nil properties' do
40
- subject.class.attribute_types.each { |prop, _| subject.send(prop).should == nil }
41
- end
38
+ it 'has all nil properties' do
39
+ subject.class.attribute_types.each { |prop, _| subject.send(prop).should == nil }
40
+ end
42
41
 
43
- its (:book) {should == nil}
44
- end
42
+ its (:book) {should == nil}
43
+ end
45
44
 
46
- describe '#new with opts' do
45
+ describe '#new with opts' do
47
46
 
48
- let(:property_hash) do
49
- {:isin_id => 1234567,
50
- :repl_id => 12,
51
- :rev => 123,
52
- :price => 1234,
53
- :amount => 12345,
54
- :deal_id => 1212,
55
- :sess_id => 1213,
56
- :moment => 'time',
57
- :status_sell => 0,
58
- :status_buy => 0,
59
- :id_ord_sell => 123456,
60
- :id_ord_buy => 654321,
61
- :pos => 121212, # ���-�� ������� �� ����������� �� ����� ����� ������.
62
- :nosystem => 0, # 1-������������ ������, 0-�������
63
- :id_repo => 0, # ����� ������ ����� ������ ����
64
- :id_deal_multileg => 0, # ����� ������ �� ������
65
- :book=> 123456,
66
- }
47
+ let(:property_hash) do
48
+ {:isin_id => 1234567,
49
+ :repl_id => 12,
50
+ :rev => 123,
51
+ :price => 1234,
52
+ :amount => 12345,
53
+ :deal_id => 1212,
54
+ :sess_id => 1213,
55
+ :moment => 'time',
56
+ :status_sell => 0,
57
+ :status_buy => 0,
58
+ :id_ord_sell => 123456,
59
+ :id_ord_buy => 654321,
60
+ :pos => 121212, # ���-�� ������� �� ����������� �� ����� ����� ������.
61
+ :nosystem => 0, # 1-������������ ������, 0-�������
62
+ :id_repo => 0, # ����� ������ ����� ������ ����
63
+ :id_deal_multileg => 0, # ����� ������ �� ������
64
+ :book=> 123456,
65
+ }
66
+ end
67
+ subject { Fin::Deal.new property_hash }
68
+ it_behaves_like 'deal_with_set_properties'
67
69
  end
68
- subject { Fin::Deal.new property_hash }
69
- it_behaves_like 'deal_with_set_properties'
70
70
  end
71
71
  end
72
72
 
@@ -111,14 +111,6 @@ describe Fin::Model, "as a base class for BD models" do
111
111
  mock('record').tap do |mock|
112
112
  mock.stub(:GetValAsString) do |field|
113
113
  case field
114
- when 'replID'
115
- '11'
116
- when 'replRev'
117
- '12'
118
- when 'replAct'
119
- '13'
120
- when 'longint'
121
- '1322222222455664'
122
114
  when 'name'
123
115
  'rec_name'
124
116
  when 'time'
@@ -139,8 +131,16 @@ describe Fin::Model, "as a base class for BD models" do
139
131
  end
140
132
  mock.stub(:GetValAsVariant) do |field|
141
133
  case field
134
+ when 'longint'
135
+ 1322222222455664
142
136
  when 'time'
143
137
  20100101003030000
138
+ when 'replID'
139
+ 11
140
+ when 'replRev'
141
+ 12
142
+ when 'replAct'
143
+ 13
144
144
  end
145
145
  end
146
146
  end
@@ -38,7 +38,8 @@ describe Fin::Order do
38
38
  {:repl_id => 12,
39
39
  :amount => 12345,
40
40
  :price => 1234,
41
- :dir => 1
41
+ :dir => 1,
42
+ :local_stamp => 20100101003030000
42
43
  }
43
44
  end
44
45
  subject { Fin::Order.new property_hash }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fin
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - arvicco
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-18 00:00:00 +03:00
13
+ date: 2011-11-23 00:00:00 +03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency