radar-api 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,15 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-dev)
2
+ # Autogenerated by Thrift Compiler (0.9.3)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
7
  require 'thrift'
8
+ require 'radar/api/common_types'
9
+
8
10
 
9
11
  module Radar
10
- module API
12
+ module Api
11
13
  module LineSeriesType
12
14
  LINE = 0
13
15
  AREA = 1
@@ -42,111 +44,6 @@ module Radar
42
44
  VALID_VALUES = Set.new([DIVIDEND, INTEREST_ON_OWN_CAPITAL, DEPOSIT, WITHDRAWAL]).freeze
43
45
  end
44
46
 
45
- class StockId
46
- include ::Thrift::Struct, ::Thrift::Struct_Union
47
- SYMBOL = 1
48
-
49
- FIELDS = {
50
- SYMBOL => {:type => ::Thrift::Types::STRING, :name => 'symbol'}
51
- }
52
-
53
- def struct_fields; FIELDS; end
54
-
55
- def validate
56
- end
57
-
58
- ::Thrift::Struct.generate_accessors self
59
- end
60
-
61
- class IndexId
62
- include ::Thrift::Struct, ::Thrift::Struct_Union
63
- SYMBOL = 1
64
-
65
- FIELDS = {
66
- SYMBOL => {:type => ::Thrift::Types::STRING, :name => 'symbol'}
67
- }
68
-
69
- def struct_fields; FIELDS; end
70
-
71
- def validate
72
- end
73
-
74
- ::Thrift::Struct.generate_accessors self
75
- end
76
-
77
- class FundId
78
- include ::Thrift::Struct, ::Thrift::Struct_Union
79
- CNPJ = 1
80
-
81
- FIELDS = {
82
- CNPJ => {:type => ::Thrift::Types::STRING, :name => 'cnpj'}
83
- }
84
-
85
- def struct_fields; FIELDS; end
86
-
87
- def validate
88
- end
89
-
90
- ::Thrift::Struct.generate_accessors self
91
- end
92
-
93
- class IndexLinkedBondId
94
- include ::Thrift::Struct, ::Thrift::Struct_Union
95
- INDEX = 1
96
- FACTOR = 2
97
- BASE_DATE = 3
98
- MATURITY_DATE = 4
99
-
100
- FIELDS = {
101
- INDEX => {:type => ::Thrift::Types::STRUCT, :name => 'index', :class => ::Radar::API::IndexId},
102
- FACTOR => {:type => ::Thrift::Types::DOUBLE, :name => 'factor'},
103
- BASE_DATE => {:type => ::Thrift::Types::I32, :name => 'base_date'},
104
- MATURITY_DATE => {:type => ::Thrift::Types::I32, :name => 'maturity_date'}
105
- }
106
-
107
- def struct_fields; FIELDS; end
108
-
109
- def validate
110
- end
111
-
112
- ::Thrift::Struct.generate_accessors self
113
- end
114
-
115
- class SecurityId < ::Thrift::Union
116
- include ::Thrift::Struct_Union
117
- class << self
118
- def stock(val)
119
- SecurityId.new(:stock, val)
120
- end
121
-
122
- def fund(val)
123
- SecurityId.new(:fund, val)
124
- end
125
-
126
- def index_linked_bond(val)
127
- SecurityId.new(:index_linked_bond, val)
128
- end
129
- end
130
-
131
- STOCK = 1
132
- FUND = 2
133
- INDEX_LINKED_BOND = 3
134
-
135
- FIELDS = {
136
- STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::API::StockId},
137
- FUND => {:type => ::Thrift::Types::STRUCT, :name => 'fund', :class => ::Radar::API::FundId},
138
- INDEX_LINKED_BOND => {:type => ::Thrift::Types::STRUCT, :name => 'index_linked_bond', :class => ::Radar::API::IndexLinkedBondId}
139
- }
140
-
141
- def struct_fields; FIELDS; end
142
-
143
- def validate
144
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
145
- end
146
-
147
- ::Thrift::Union.generate_accessors self
148
- end
149
-
150
47
  class Point
151
48
  include ::Thrift::Struct, ::Thrift::Struct_Union
152
49
  X = 1
@@ -190,7 +87,7 @@ module Radar
190
87
 
191
88
  FIELDS = {
192
89
  TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
193
- SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::PieSeries}}
90
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::PieSeries}}
194
91
  }
195
92
 
196
93
  def struct_fields; FIELDS; end
@@ -209,14 +106,14 @@ module Radar
209
106
 
210
107
  FIELDS = {
211
108
  NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
212
- POINTS => {:type => ::Thrift::Types::LIST, :name => 'points', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Point}},
213
- TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :default => 0, :enum_class => ::Radar::API::LineSeriesType}
109
+ POINTS => {:type => ::Thrift::Types::LIST, :name => 'points', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Point}},
110
+ TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :default => 0, :enum_class => ::Radar::Api::LineSeriesType}
214
111
  }
215
112
 
216
113
  def struct_fields; FIELDS; end
217
114
 
218
115
  def validate
219
- unless @type.nil? || ::Radar::API::LineSeriesType::VALID_VALUES.include?(@type)
116
+ unless @type.nil? || ::Radar::Api::LineSeriesType::VALID_VALUES.include?(@type)
220
117
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
221
118
  end
222
119
  end
@@ -250,8 +147,8 @@ module Radar
250
147
 
251
148
  FIELDS = {
252
149
  TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
253
- SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::LineSeries}},
254
- OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Radar::API::LineChartOptions}
150
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::LineSeries}},
151
+ OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Radar::Api::LineChartOptions}
255
152
  }
256
153
 
257
154
  def struct_fields; FIELDS; end
@@ -315,10 +212,10 @@ module Radar
315
212
 
316
213
  FIELDS = {
317
214
  TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
318
- SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::BarSeries}},
215
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::BarSeries}},
319
216
  CATEGORIES => {:type => ::Thrift::Types::LIST, :name => 'categories', :element => {:type => ::Thrift::Types::STRING}},
320
217
  # Criado na versão 0.2.2.
321
- OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Radar::API::BarChartOptions}
218
+ OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Radar::Api::BarChartOptions}
322
219
  }
323
220
 
324
221
  def struct_fields; FIELDS; end
@@ -418,8 +315,8 @@ module Radar
418
315
  FORMAT = 2
419
316
 
420
317
  FIELDS = {
421
- CONTENT => {:type => ::Thrift::Types::STRUCT, :name => 'content', :class => ::Radar::API::TableCellContent},
422
- FORMAT => {:type => ::Thrift::Types::STRUCT, :name => 'format', :class => ::Radar::API::TableCellFormat}
318
+ CONTENT => {:type => ::Thrift::Types::STRUCT, :name => 'content', :class => ::Radar::Api::TableCellContent},
319
+ FORMAT => {:type => ::Thrift::Types::STRUCT, :name => 'format', :class => ::Radar::Api::TableCellFormat}
423
320
  }
424
321
 
425
322
  def struct_fields; FIELDS; end
@@ -435,7 +332,7 @@ module Radar
435
332
  CELLS = 1
436
333
 
437
334
  FIELDS = {
438
- CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableCell}}
335
+ CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::TableCell}}
439
336
  }
440
337
 
441
338
  def struct_fields; FIELDS; end
@@ -455,9 +352,9 @@ module Radar
455
352
 
456
353
  FIELDS = {
457
354
  TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
458
- HEADER => {:type => ::Thrift::Types::LIST, :name => 'header', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}},
459
- BODY => {:type => ::Thrift::Types::LIST, :name => 'body', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}},
460
- FOOTER => {:type => ::Thrift::Types::LIST, :name => 'footer', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}}
355
+ HEADER => {:type => ::Thrift::Types::LIST, :name => 'header', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::TableRow}},
356
+ BODY => {:type => ::Thrift::Types::LIST, :name => 'body', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::TableRow}},
357
+ FOOTER => {:type => ::Thrift::Types::LIST, :name => 'footer', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::TableRow}}
461
358
  }
462
359
 
463
360
  def struct_fields; FIELDS; end
@@ -494,10 +391,10 @@ module Radar
494
391
  BAR_CHART = 4
495
392
 
496
393
  FIELDS = {
497
- TABLE => {:type => ::Thrift::Types::STRUCT, :name => 'table', :class => ::Radar::API::Table},
498
- PIE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'pie_chart', :class => ::Radar::API::PieChart},
499
- LINE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'line_chart', :class => ::Radar::API::LineChart},
500
- BAR_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'bar_chart', :class => ::Radar::API::BarChart}
394
+ TABLE => {:type => ::Thrift::Types::STRUCT, :name => 'table', :class => ::Radar::Api::Table},
395
+ PIE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'pie_chart', :class => ::Radar::Api::PieChart},
396
+ LINE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'line_chart', :class => ::Radar::Api::LineChart},
397
+ BAR_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'bar_chart', :class => ::Radar::Api::BarChart}
501
398
  }
502
399
 
503
400
  def struct_fields; FIELDS; end
@@ -518,7 +415,7 @@ module Radar
518
415
  SHARES = 5
519
416
 
520
417
  FIELDS = {
521
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
418
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
522
419
  VALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'value'},
523
420
  RENTABILITY => {:type => ::Thrift::Types::DOUBLE, :name => 'rentability'},
524
421
  AVG_PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'avg_price'},
@@ -573,7 +470,7 @@ module Radar
573
470
  FIELDS = {
574
471
  VALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'value'},
575
472
  DESCRIPTION => {:type => ::Thrift::Types::STRING, :name => 'description'},
576
- SETTLEMENT => {:type => ::Thrift::Types::STRUCT, :name => 'settlement', :class => ::Radar::API::Settlement}
473
+ SETTLEMENT => {:type => ::Thrift::Types::STRUCT, :name => 'settlement', :class => ::Radar::Api::Settlement}
577
474
  }
578
475
 
579
476
  def struct_fields; FIELDS; end
@@ -595,12 +492,12 @@ module Radar
595
492
 
596
493
  FIELDS = {
597
494
  DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
598
- POSITIONS => {:type => ::Thrift::Types::LIST, :name => 'positions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Position}},
495
+ POSITIONS => {:type => ::Thrift::Types::LIST, :name => 'positions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Position}},
599
496
  RENTABILITY => {:type => ::Thrift::Types::DOUBLE, :name => 'rentability'},
600
497
  NAV => {:type => ::Thrift::Types::DOUBLE, :name => 'nav'},
601
498
  CASH => {:type => ::Thrift::Types::DOUBLE, :name => 'cash'},
602
499
  # Criado na versão 0.2.1
603
- PROVISIONS => {:type => ::Thrift::Types::LIST, :name => 'provisions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Provision}}
500
+ PROVISIONS => {:type => ::Thrift::Types::LIST, :name => 'provisions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Provision}}
604
501
  }
605
502
 
606
503
  def struct_fields; FIELDS; end
@@ -621,14 +518,14 @@ module Radar
621
518
  FIELDS = {
622
519
  ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
623
520
  NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
624
- RESULT_TYPE => {:type => ::Thrift::Types::I32, :name => 'result_type', :enum_class => ::Radar::API::ResultType},
625
- ACCEPTED_EVENTS => {:type => ::Thrift::Types::SET, :name => 'accepted_events', :element => {:type => ::Thrift::Types::I32, :enum_class => ::Radar::API::Event}}
521
+ RESULT_TYPE => {:type => ::Thrift::Types::I32, :name => 'result_type', :enum_class => ::Radar::Api::ResultType},
522
+ ACCEPTED_EVENTS => {:type => ::Thrift::Types::SET, :name => 'accepted_events', :element => {:type => ::Thrift::Types::I32, :enum_class => ::Radar::Api::Event}}
626
523
  }
627
524
 
628
525
  def struct_fields; FIELDS; end
629
526
 
630
527
  def validate
631
- unless @result_type.nil? || ::Radar::API::ResultType::VALID_VALUES.include?(@result_type)
528
+ unless @result_type.nil? || ::Radar::Api::ResultType::VALID_VALUES.include?(@result_type)
632
529
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field result_type!')
633
530
  end
634
531
  end
@@ -636,24 +533,6 @@ module Radar
636
533
  ::Thrift::Struct.generate_accessors self
637
534
  end
638
535
 
639
- class Price
640
- include ::Thrift::Struct, ::Thrift::Struct_Union
641
- DATE = 1
642
- CLOSE = 2
643
-
644
- FIELDS = {
645
- DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
646
- CLOSE => {:type => ::Thrift::Types::DOUBLE, :name => 'close'}
647
- }
648
-
649
- def struct_fields; FIELDS; end
650
-
651
- def validate
652
- end
653
-
654
- ::Thrift::Struct.generate_accessors self
655
- end
656
-
657
536
  class CashFlow
658
537
  include ::Thrift::Struct, ::Thrift::Struct_Union
659
538
  DATE = 1
@@ -665,13 +544,13 @@ module Radar
665
544
  DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
666
545
  VALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'value'},
667
546
  BALANCE => {:type => ::Thrift::Types::DOUBLE, :name => 'balance'},
668
- TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :enum_class => ::Radar::API::CashFlowType}
547
+ TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :enum_class => ::Radar::Api::CashFlowType}
669
548
  }
670
549
 
671
550
  def struct_fields; FIELDS; end
672
551
 
673
552
  def validate
674
- unless @type.nil? || ::Radar::API::CashFlowType::VALID_VALUES.include?(@type)
553
+ unless @type.nil? || ::Radar::Api::CashFlowType::VALID_VALUES.include?(@type)
675
554
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
676
555
  end
677
556
  end
@@ -679,25 +558,5 @@ module Radar
679
558
  ::Thrift::Struct.generate_accessors self
680
559
  end
681
560
 
682
- class DailyFundData
683
- include ::Thrift::Struct, ::Thrift::Struct_Union
684
- PRICE = 1
685
- DATE = 2
686
- NAV = 3
687
-
688
- FIELDS = {
689
- PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'price'},
690
- DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
691
- NAV => {:type => ::Thrift::Types::DOUBLE, :name => 'nav'}
692
- }
693
-
694
- def struct_fields; FIELDS; end
695
-
696
- def validate
697
- end
698
-
699
- ::Thrift::Struct.generate_accessors self
700
- end
701
-
702
561
  end
703
562
  end
@@ -1,14 +1,14 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (1.0.0-dev)
2
+ # Autogenerated by Thrift Compiler (0.9.3)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
7
  require 'thrift'
8
- require 'radar_types'
8
+ require 'radar/api/data_server_types'
9
9
 
10
10
  module Radar
11
- module API
11
+ module Api
12
12
  module SecurityService
13
13
  class Client
14
14
  include ::Thrift::Client
@@ -159,7 +159,7 @@ module Radar
159
159
  ID = 1
160
160
 
161
161
  FIELDS = {
162
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId}
162
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId}
163
163
  }
164
164
 
165
165
  def struct_fields; FIELDS; end
@@ -193,7 +193,7 @@ module Radar
193
193
  END_DATE = 3
194
194
 
195
195
  FIELDS = {
196
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
196
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
197
197
  START_DATE => {:type => ::Thrift::Types::I32, :name => 'start_date'},
198
198
  END_DATE => {:type => ::Thrift::Types::I32, :name => 'end_date'}
199
199
  }
@@ -211,7 +211,7 @@ module Radar
211
211
  SUCCESS = 0
212
212
 
213
213
  FIELDS = {
214
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Price}}
214
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Price}}
215
215
  }
216
216
 
217
217
  def struct_fields; FIELDS; end
@@ -228,7 +228,7 @@ module Radar
228
228
  DATE = 2
229
229
 
230
230
  FIELDS = {
231
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
231
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
232
232
  DATE => {:type => ::Thrift::Types::I32, :name => 'date'}
233
233
  }
234
234
 
@@ -263,7 +263,7 @@ module Radar
263
263
  END_DATE = 3
264
264
 
265
265
  FIELDS = {
266
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
266
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
267
267
  START_DATE => {:type => ::Thrift::Types::I32, :name => 'start_date'},
268
268
  END_DATE => {:type => ::Thrift::Types::I32, :name => 'end_date'}
269
269
  }
@@ -299,7 +299,7 @@ module Radar
299
299
  END_DATE = 3
300
300
 
301
301
  FIELDS = {
302
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
302
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
303
303
  START_DATE => {:type => ::Thrift::Types::I32, :name => 'start_date'},
304
304
  END_DATE => {:type => ::Thrift::Types::I32, :name => 'end_date'}
305
305
  }
@@ -335,7 +335,7 @@ module Radar
335
335
  END_DATE = 3
336
336
 
337
337
  FIELDS = {
338
- ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
338
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::Api::SecurityId},
339
339
  START_DATE => {:type => ::Thrift::Types::I32, :name => 'start_date'},
340
340
  END_DATE => {:type => ::Thrift::Types::I32, :name => 'end_date'}
341
341
  }
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.3)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar/api/transaction_sync_types'
9
+
10
+ module Radar
11
+ module Api
12
+ end
13
+ end
@@ -0,0 +1,117 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.3)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar/api/common_types'
9
+
10
+
11
+ module Radar
12
+ module Api
13
+ module StockBuyTransactionType
14
+ REGULAR = 1
15
+ IPO = 2
16
+ VALUE_MAP = {1 => "REGULAR", 2 => "IPO"}
17
+ VALID_VALUES = Set.new([REGULAR, IPO]).freeze
18
+ end
19
+
20
+ class StockSellTransaction
21
+ include ::Thrift::Struct, ::Thrift::Struct_Union
22
+ DATE = 1
23
+ STOCK = 2
24
+ SHARES = 3
25
+ PRICE = 4
26
+
27
+ FIELDS = {
28
+ DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
29
+ STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::Api::StockId},
30
+ SHARES => {:type => ::Thrift::Types::I32, :name => 'shares'},
31
+ PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'price'}
32
+ }
33
+
34
+ def struct_fields; FIELDS; end
35
+
36
+ def validate
37
+ end
38
+
39
+ ::Thrift::Struct.generate_accessors self
40
+ end
41
+
42
+ class StockBuyTransaction
43
+ include ::Thrift::Struct, ::Thrift::Struct_Union
44
+ DATE = 1
45
+ STOCK = 2
46
+ SHARES = 3
47
+ PRICE = 4
48
+ TYPE = 5
49
+
50
+ FIELDS = {
51
+ DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
52
+ STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::Api::StockId},
53
+ SHARES => {:type => ::Thrift::Types::I32, :name => 'shares'},
54
+ PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'price'},
55
+ TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :default => 1, :enum_class => ::Radar::Api::StockBuyTransactionType}
56
+ }
57
+
58
+ def struct_fields; FIELDS; end
59
+
60
+ def validate
61
+ unless @type.nil? || ::Radar::Api::StockBuyTransactionType::VALID_VALUES.include?(@type)
62
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
63
+ end
64
+ end
65
+
66
+ ::Thrift::Struct.generate_accessors self
67
+ end
68
+
69
+ class Transaction < ::Thrift::Union
70
+ include ::Thrift::Struct_Union
71
+ class << self
72
+ def stock_buy(val)
73
+ Transaction.new(:stock_buy, val)
74
+ end
75
+
76
+ def stock_sell(val)
77
+ Transaction.new(:stock_sell, val)
78
+ end
79
+ end
80
+
81
+ STOCK_BUY = 1
82
+ STOCK_SELL = 2
83
+
84
+ FIELDS = {
85
+ STOCK_BUY => {:type => ::Thrift::Types::STRUCT, :name => 'stock_buy', :class => ::Radar::Api::StockBuyTransaction},
86
+ STOCK_SELL => {:type => ::Thrift::Types::STRUCT, :name => 'stock_sell', :class => ::Radar::Api::StockSellTransaction}
87
+ }
88
+
89
+ def struct_fields; FIELDS; end
90
+
91
+ def validate
92
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
93
+ end
94
+
95
+ ::Thrift::Union.generate_accessors self
96
+ end
97
+
98
+ class TransactionSynchronizerConfig
99
+ include ::Thrift::Struct, ::Thrift::Struct_Union
100
+ ID = 1
101
+ NAME = 2
102
+
103
+ FIELDS = {
104
+ ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
105
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
106
+ }
107
+
108
+ def struct_fields; FIELDS; end
109
+
110
+ def validate
111
+ end
112
+
113
+ ::Thrift::Struct.generate_accessors self
114
+ end
115
+
116
+ end
117
+ end
@@ -0,0 +1,135 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.9.3)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar/api/transaction_sync_types'
9
+
10
+ module Radar
11
+ module Api
12
+ module TransactionSynchronizerController
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def synchronizers()
17
+ send_synchronizers()
18
+ return recv_synchronizers()
19
+ end
20
+
21
+ def send_synchronizers()
22
+ send_message('synchronizers', Synchronizers_args)
23
+ end
24
+
25
+ def recv_synchronizers()
26
+ result = receive_message(Synchronizers_result)
27
+ return result.success unless result.success.nil?
28
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'synchronizers failed: unknown result')
29
+ end
30
+
31
+ def sync(synchronizer_id)
32
+ send_sync(synchronizer_id)
33
+ return recv_sync()
34
+ end
35
+
36
+ def send_sync(synchronizer_id)
37
+ send_message('sync', Sync_args, :synchronizer_id => synchronizer_id)
38
+ end
39
+
40
+ def recv_sync()
41
+ result = receive_message(Sync_result)
42
+ return result.success unless result.success.nil?
43
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'sync failed: unknown result')
44
+ end
45
+
46
+ end
47
+
48
+ class Processor
49
+ include ::Thrift::Processor
50
+
51
+ def process_synchronizers(seqid, iprot, oprot)
52
+ args = read_args(iprot, Synchronizers_args)
53
+ result = Synchronizers_result.new()
54
+ result.success = @handler.synchronizers()
55
+ write_result(result, oprot, 'synchronizers', seqid)
56
+ end
57
+
58
+ def process_sync(seqid, iprot, oprot)
59
+ args = read_args(iprot, Sync_args)
60
+ result = Sync_result.new()
61
+ result.success = @handler.sync(args.synchronizer_id)
62
+ write_result(result, oprot, 'sync', seqid)
63
+ end
64
+
65
+ end
66
+
67
+ # HELPER FUNCTIONS AND STRUCTURES
68
+
69
+ class Synchronizers_args
70
+ include ::Thrift::Struct, ::Thrift::Struct_Union
71
+
72
+ FIELDS = {
73
+
74
+ }
75
+
76
+ def struct_fields; FIELDS; end
77
+
78
+ def validate
79
+ end
80
+
81
+ ::Thrift::Struct.generate_accessors self
82
+ end
83
+
84
+ class Synchronizers_result
85
+ include ::Thrift::Struct, ::Thrift::Struct_Union
86
+ SUCCESS = 0
87
+
88
+ FIELDS = {
89
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::TransactionSynchronizerConfig}}
90
+ }
91
+
92
+ def struct_fields; FIELDS; end
93
+
94
+ def validate
95
+ end
96
+
97
+ ::Thrift::Struct.generate_accessors self
98
+ end
99
+
100
+ class Sync_args
101
+ include ::Thrift::Struct, ::Thrift::Struct_Union
102
+ SYNCHRONIZER_ID = 1
103
+
104
+ FIELDS = {
105
+ SYNCHRONIZER_ID => {:type => ::Thrift::Types::STRING, :name => 'synchronizer_id'}
106
+ }
107
+
108
+ def struct_fields; FIELDS; end
109
+
110
+ def validate
111
+ end
112
+
113
+ ::Thrift::Struct.generate_accessors self
114
+ end
115
+
116
+ class Sync_result
117
+ include ::Thrift::Struct, ::Thrift::Struct_Union
118
+ SUCCESS = 0
119
+
120
+ FIELDS = {
121
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Transaction}}
122
+ }
123
+
124
+ def struct_fields; FIELDS; end
125
+
126
+ def validate
127
+ end
128
+
129
+ ::Thrift::Struct.generate_accessors self
130
+ end
131
+
132
+ end
133
+
134
+ end
135
+ end