radar-api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f0ebf45d5e6e181e2fc96ad0789a4aa070700308
4
+ data.tar.gz: 96cadbd06eea353ba7313c433b62bd27f378bccb
5
+ SHA512:
6
+ metadata.gz: dbf795126e0658e37e8fcccb5a216cac45ae2614e0a402658e250a707699b0fd605d38f626332f0eb7eef3bdfcfcf675fba29169ef462268e8458bbdb97db4a4
7
+ data.tar.gz: 19e0976933c0e68d52edf2cb21f3fb6d408972a7bb13cecb599fdeb514055681c659db424d6348fd67b6d9f2faceef072f90585857fda46f6bdab0c29e2d966f
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in radar-api.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ radar-api (0.1.0)
5
+ thrift
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rake (10.1.1)
11
+ thrift (0.9.1)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.5)
18
+ radar-api!
19
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 André Aizim Kelmanson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Radar::Api
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'radar-api'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install radar-api
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/radar-api/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,374 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (1.0.0-dev)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar_types'
9
+
10
+ module Radar
11
+ module API
12
+ module AnalyzerController
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def on_each_day(sessionid, portfolio)
17
+ send_on_each_day(sessionid, portfolio)
18
+ end
19
+
20
+ def send_on_each_day(sessionid, portfolio)
21
+ send_message('on_each_day', On_each_day_args, :sessionid => sessionid, :portfolio => portfolio)
22
+ end
23
+ def on_finish(session_id, portfolio)
24
+ send_on_finish(session_id, portfolio)
25
+ end
26
+
27
+ def send_on_finish(session_id, portfolio)
28
+ send_message('on_finish', On_finish_args, :session_id => session_id, :portfolio => portfolio)
29
+ end
30
+ def create_session(session_id, analyzer_id)
31
+ send_create_session(session_id, analyzer_id)
32
+ return recv_create_session()
33
+ end
34
+
35
+ def send_create_session(session_id, analyzer_id)
36
+ send_message('create_session', Create_session_args, :session_id => session_id, :analyzer_id => analyzer_id)
37
+ end
38
+
39
+ def recv_create_session()
40
+ result = receive_message(Create_session_result)
41
+ return result.success unless result.success.nil?
42
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create_session failed: unknown result')
43
+ end
44
+
45
+ def dump(session_id)
46
+ send_dump(session_id)
47
+ return recv_dump()
48
+ end
49
+
50
+ def send_dump(session_id)
51
+ send_message('dump', Dump_args, :session_id => session_id)
52
+ end
53
+
54
+ def recv_dump()
55
+ result = receive_message(Dump_result)
56
+ return result.success unless result.success.nil?
57
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'dump failed: unknown result')
58
+ end
59
+
60
+ def resume(session_id, data)
61
+ send_resume(session_id, data)
62
+ end
63
+
64
+ def send_resume(session_id, data)
65
+ send_message('resume', Resume_args, :session_id => session_id, :data => data)
66
+ end
67
+ def result(session_id)
68
+ send_result(session_id)
69
+ return recv_result()
70
+ end
71
+
72
+ def send_result(session_id)
73
+ send_message('result', Result_args, :session_id => session_id)
74
+ end
75
+
76
+ def recv_result()
77
+ result = receive_message(Result_result)
78
+ return result.success unless result.success.nil?
79
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'result failed: unknown result')
80
+ end
81
+
82
+ def destroy_session(session_id)
83
+ send_destroy_session(session_id)
84
+ end
85
+
86
+ def send_destroy_session(session_id)
87
+ send_message('destroy_session', Destroy_session_args, :session_id => session_id)
88
+ end
89
+ end
90
+
91
+ class Processor
92
+ include ::Thrift::Processor
93
+
94
+ def process_on_each_day(seqid, iprot, oprot)
95
+ args = read_args(iprot, On_each_day_args)
96
+ @handler.on_each_day(args.sessionid, args.portfolio)
97
+ return
98
+ end
99
+
100
+ def process_on_finish(seqid, iprot, oprot)
101
+ args = read_args(iprot, On_finish_args)
102
+ @handler.on_finish(args.session_id, args.portfolio)
103
+ return
104
+ end
105
+
106
+ def process_create_session(seqid, iprot, oprot)
107
+ args = read_args(iprot, Create_session_args)
108
+ result = Create_session_result.new()
109
+ result.success = @handler.create_session(args.session_id, args.analyzer_id)
110
+ write_result(result, oprot, 'create_session', seqid)
111
+ end
112
+
113
+ def process_dump(seqid, iprot, oprot)
114
+ args = read_args(iprot, Dump_args)
115
+ result = Dump_result.new()
116
+ result.success = @handler.dump(args.session_id)
117
+ write_result(result, oprot, 'dump', seqid)
118
+ end
119
+
120
+ def process_resume(seqid, iprot, oprot)
121
+ args = read_args(iprot, Resume_args)
122
+ @handler.resume(args.session_id, args.data)
123
+ return
124
+ end
125
+
126
+ def process_result(seqid, iprot, oprot)
127
+ args = read_args(iprot, Result_args)
128
+ result = Result_result.new()
129
+ result.success = @handler.result(args.session_id)
130
+ write_result(result, oprot, 'result', seqid)
131
+ end
132
+
133
+ def process_destroy_session(seqid, iprot, oprot)
134
+ args = read_args(iprot, Destroy_session_args)
135
+ @handler.destroy_session(args.session_id)
136
+ return
137
+ end
138
+
139
+ end
140
+
141
+ # HELPER FUNCTIONS AND STRUCTURES
142
+
143
+ class On_each_day_args
144
+ include ::Thrift::Struct, ::Thrift::Struct_Union
145
+ SESSIONID = 1
146
+ PORTFOLIO = 2
147
+
148
+ FIELDS = {
149
+ SESSIONID => {:type => ::Thrift::Types::I32, :name => 'sessionid'},
150
+ PORTFOLIO => {:type => ::Thrift::Types::STRUCT, :name => 'portfolio', :class => ::Radar::API::Portfolio}
151
+ }
152
+
153
+ def struct_fields; FIELDS; end
154
+
155
+ def validate
156
+ end
157
+
158
+ ::Thrift::Struct.generate_accessors self
159
+ end
160
+
161
+ class On_each_day_result
162
+ include ::Thrift::Struct, ::Thrift::Struct_Union
163
+
164
+ FIELDS = {
165
+
166
+ }
167
+
168
+ def struct_fields; FIELDS; end
169
+
170
+ def validate
171
+ end
172
+
173
+ ::Thrift::Struct.generate_accessors self
174
+ end
175
+
176
+ class On_finish_args
177
+ include ::Thrift::Struct, ::Thrift::Struct_Union
178
+ SESSION_ID = 1
179
+ PORTFOLIO = 2
180
+
181
+ FIELDS = {
182
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'},
183
+ PORTFOLIO => {:type => ::Thrift::Types::STRUCT, :name => 'portfolio', :class => ::Radar::API::Portfolio}
184
+ }
185
+
186
+ def struct_fields; FIELDS; end
187
+
188
+ def validate
189
+ end
190
+
191
+ ::Thrift::Struct.generate_accessors self
192
+ end
193
+
194
+ class On_finish_result
195
+ include ::Thrift::Struct, ::Thrift::Struct_Union
196
+
197
+ FIELDS = {
198
+
199
+ }
200
+
201
+ def struct_fields; FIELDS; end
202
+
203
+ def validate
204
+ end
205
+
206
+ ::Thrift::Struct.generate_accessors self
207
+ end
208
+
209
+ class Create_session_args
210
+ include ::Thrift::Struct, ::Thrift::Struct_Union
211
+ SESSION_ID = 1
212
+ ANALYZER_ID = 2
213
+
214
+ FIELDS = {
215
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'},
216
+ ANALYZER_ID => {:type => ::Thrift::Types::STRING, :name => 'analyzer_id'}
217
+ }
218
+
219
+ def struct_fields; FIELDS; end
220
+
221
+ def validate
222
+ end
223
+
224
+ ::Thrift::Struct.generate_accessors self
225
+ end
226
+
227
+ class Create_session_result
228
+ include ::Thrift::Struct, ::Thrift::Struct_Union
229
+ SUCCESS = 0
230
+
231
+ FIELDS = {
232
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Radar::API::AnalyzerConfig}
233
+ }
234
+
235
+ def struct_fields; FIELDS; end
236
+
237
+ def validate
238
+ end
239
+
240
+ ::Thrift::Struct.generate_accessors self
241
+ end
242
+
243
+ class Dump_args
244
+ include ::Thrift::Struct, ::Thrift::Struct_Union
245
+ SESSION_ID = 1
246
+
247
+ FIELDS = {
248
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'}
249
+ }
250
+
251
+ def struct_fields; FIELDS; end
252
+
253
+ def validate
254
+ end
255
+
256
+ ::Thrift::Struct.generate_accessors self
257
+ end
258
+
259
+ class Dump_result
260
+ include ::Thrift::Struct, ::Thrift::Struct_Union
261
+ SUCCESS = 0
262
+
263
+ FIELDS = {
264
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success', :binary => true}
265
+ }
266
+
267
+ def struct_fields; FIELDS; end
268
+
269
+ def validate
270
+ end
271
+
272
+ ::Thrift::Struct.generate_accessors self
273
+ end
274
+
275
+ class Resume_args
276
+ include ::Thrift::Struct, ::Thrift::Struct_Union
277
+ SESSION_ID = 1
278
+ DATA = 2
279
+
280
+ FIELDS = {
281
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'},
282
+ DATA => {:type => ::Thrift::Types::STRING, :name => 'data', :binary => true}
283
+ }
284
+
285
+ def struct_fields; FIELDS; end
286
+
287
+ def validate
288
+ end
289
+
290
+ ::Thrift::Struct.generate_accessors self
291
+ end
292
+
293
+ class Resume_result
294
+ include ::Thrift::Struct, ::Thrift::Struct_Union
295
+
296
+ FIELDS = {
297
+
298
+ }
299
+
300
+ def struct_fields; FIELDS; end
301
+
302
+ def validate
303
+ end
304
+
305
+ ::Thrift::Struct.generate_accessors self
306
+ end
307
+
308
+ class Result_args
309
+ include ::Thrift::Struct, ::Thrift::Struct_Union
310
+ SESSION_ID = 1
311
+
312
+ FIELDS = {
313
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'}
314
+ }
315
+
316
+ def struct_fields; FIELDS; end
317
+
318
+ def validate
319
+ end
320
+
321
+ ::Thrift::Struct.generate_accessors self
322
+ end
323
+
324
+ class Result_result
325
+ include ::Thrift::Struct, ::Thrift::Struct_Union
326
+ SUCCESS = 0
327
+
328
+ FIELDS = {
329
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Radar::API::Result}
330
+ }
331
+
332
+ def struct_fields; FIELDS; end
333
+
334
+ def validate
335
+ end
336
+
337
+ ::Thrift::Struct.generate_accessors self
338
+ end
339
+
340
+ class Destroy_session_args
341
+ include ::Thrift::Struct, ::Thrift::Struct_Union
342
+ SESSION_ID = 1
343
+
344
+ FIELDS = {
345
+ SESSION_ID => {:type => ::Thrift::Types::I32, :name => 'session_id'}
346
+ }
347
+
348
+ def struct_fields; FIELDS; end
349
+
350
+ def validate
351
+ end
352
+
353
+ ::Thrift::Struct.generate_accessors self
354
+ end
355
+
356
+ class Destroy_session_result
357
+ include ::Thrift::Struct, ::Thrift::Struct_Union
358
+
359
+ FIELDS = {
360
+
361
+ }
362
+
363
+ def struct_fields; FIELDS; end
364
+
365
+ def validate
366
+ end
367
+
368
+ ::Thrift::Struct.generate_accessors self
369
+ end
370
+
371
+ end
372
+
373
+ end
374
+ end
@@ -0,0 +1,82 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (1.0.0-dev)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar_types'
9
+
10
+ module Radar
11
+ module API
12
+ module FundService
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def name(id)
17
+ send_name(id)
18
+ return recv_name()
19
+ end
20
+
21
+ def send_name(id)
22
+ send_message('name', Name_args, :id => id)
23
+ end
24
+
25
+ def recv_name()
26
+ result = receive_message(Name_result)
27
+ return result.success unless result.success.nil?
28
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'name failed: unknown result')
29
+ end
30
+
31
+ end
32
+
33
+ class Processor
34
+ include ::Thrift::Processor
35
+
36
+ def process_name(seqid, iprot, oprot)
37
+ args = read_args(iprot, Name_args)
38
+ result = Name_result.new()
39
+ result.success = @handler.name(args.id)
40
+ write_result(result, oprot, 'name', seqid)
41
+ end
42
+
43
+ end
44
+
45
+ # HELPER FUNCTIONS AND STRUCTURES
46
+
47
+ class Name_args
48
+ include ::Thrift::Struct, ::Thrift::Struct_Union
49
+ ID = 1
50
+
51
+ FIELDS = {
52
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::FundId}
53
+ }
54
+
55
+ def struct_fields; FIELDS; end
56
+
57
+ def validate
58
+ end
59
+
60
+ ::Thrift::Struct.generate_accessors self
61
+ end
62
+
63
+ class Name_result
64
+ include ::Thrift::Struct, ::Thrift::Struct_Union
65
+ SUCCESS = 0
66
+
67
+ FIELDS = {
68
+ SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
69
+ }
70
+
71
+ def struct_fields; FIELDS; end
72
+
73
+ def validate
74
+ end
75
+
76
+ ::Thrift::Struct.generate_accessors self
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (1.0.0-dev)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+ require 'radar_types'
9
+
10
+ module Radar
11
+ module API
12
+ end
13
+ end
@@ -0,0 +1,530 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (1.0.0-dev)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+
9
+ module Radar
10
+ module API
11
+ module LineSeriesType
12
+ LINE = 0
13
+ AREA = 1
14
+ VALUE_MAP = {0 => "LINE", 1 => "AREA"}
15
+ VALID_VALUES = Set.new([LINE, AREA]).freeze
16
+ end
17
+
18
+ module Event
19
+ EACH_DAY = 0
20
+ EACH_MONTH = 1
21
+ FINISH = 2
22
+ VALUE_MAP = {0 => "EACH_DAY", 1 => "EACH_MONTH", 2 => "FINISH"}
23
+ VALID_VALUES = Set.new([EACH_DAY, EACH_MONTH, FINISH]).freeze
24
+ end
25
+
26
+ module ResultType
27
+ TABLE = 0
28
+ PIE_CHART = 1
29
+ LINE_CHART = 2
30
+ BAR_CHART = 3
31
+ VALUE_MAP = {0 => "TABLE", 1 => "PIE_CHART", 2 => "LINE_CHART", 3 => "BAR_CHART"}
32
+ VALID_VALUES = Set.new([TABLE, PIE_CHART, LINE_CHART, BAR_CHART]).freeze
33
+ end
34
+
35
+ class StockId
36
+ include ::Thrift::Struct, ::Thrift::Struct_Union
37
+ SYMBOL = 1
38
+
39
+ FIELDS = {
40
+ SYMBOL => {:type => ::Thrift::Types::STRING, :name => 'symbol'}
41
+ }
42
+
43
+ def struct_fields; FIELDS; end
44
+
45
+ def validate
46
+ end
47
+
48
+ ::Thrift::Struct.generate_accessors self
49
+ end
50
+
51
+ class IndexId
52
+ include ::Thrift::Struct, ::Thrift::Struct_Union
53
+ SYMBOL = 1
54
+
55
+ FIELDS = {
56
+ SYMBOL => {:type => ::Thrift::Types::STRING, :name => 'symbol'}
57
+ }
58
+
59
+ def struct_fields; FIELDS; end
60
+
61
+ def validate
62
+ end
63
+
64
+ ::Thrift::Struct.generate_accessors self
65
+ end
66
+
67
+ class FundId
68
+ include ::Thrift::Struct, ::Thrift::Struct_Union
69
+ CNPJ = 1
70
+
71
+ FIELDS = {
72
+ CNPJ => {:type => ::Thrift::Types::STRING, :name => 'cnpj'}
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ end
79
+
80
+ ::Thrift::Struct.generate_accessors self
81
+ end
82
+
83
+ class IndexLinkedBondId
84
+ include ::Thrift::Struct, ::Thrift::Struct_Union
85
+ INDEX = 1
86
+ FATOR = 2
87
+
88
+ FIELDS = {
89
+ INDEX => {:type => ::Thrift::Types::STRUCT, :name => 'index', :class => ::Radar::API::IndexId},
90
+ FATOR => {:type => ::Thrift::Types::DOUBLE, :name => 'fator'}
91
+ }
92
+
93
+ def struct_fields; FIELDS; end
94
+
95
+ def validate
96
+ end
97
+
98
+ ::Thrift::Struct.generate_accessors self
99
+ end
100
+
101
+ class SecurityId < ::Thrift::Union
102
+ include ::Thrift::Struct_Union
103
+ class << self
104
+ def stock(val)
105
+ SecurityId.new(:stock, val)
106
+ end
107
+
108
+ def fund(val)
109
+ SecurityId.new(:fund, val)
110
+ end
111
+
112
+ def index_linked_bond(val)
113
+ SecurityId.new(:index_linked_bond, val)
114
+ end
115
+ end
116
+
117
+ STOCK = 1
118
+ FUND = 2
119
+ INDEX_LINKED_BOND = 3
120
+
121
+ FIELDS = {
122
+ STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::API::StockId},
123
+ FUND => {:type => ::Thrift::Types::STRUCT, :name => 'fund', :class => ::Radar::API::FundId},
124
+ INDEX_LINKED_BOND => {:type => ::Thrift::Types::STRUCT, :name => 'index_linked_bond', :class => ::Radar::API::IndexLinkedBondId}
125
+ }
126
+
127
+ def struct_fields; FIELDS; end
128
+
129
+ def validate
130
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
131
+ end
132
+
133
+ ::Thrift::Union.generate_accessors self
134
+ end
135
+
136
+ class Point
137
+ include ::Thrift::Struct, ::Thrift::Struct_Union
138
+ X = 1
139
+ Y = 2
140
+
141
+ FIELDS = {
142
+ X => {:type => ::Thrift::Types::I32, :name => 'x'},
143
+ Y => {:type => ::Thrift::Types::DOUBLE, :name => 'y'}
144
+ }
145
+
146
+ def struct_fields; FIELDS; end
147
+
148
+ def validate
149
+ end
150
+
151
+ ::Thrift::Struct.generate_accessors self
152
+ end
153
+
154
+ class PieSeries
155
+ include ::Thrift::Struct, ::Thrift::Struct_Union
156
+ NAME = 1
157
+ VALUE = 2
158
+
159
+ FIELDS = {
160
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
161
+ VALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'value'}
162
+ }
163
+
164
+ def struct_fields; FIELDS; end
165
+
166
+ def validate
167
+ end
168
+
169
+ ::Thrift::Struct.generate_accessors self
170
+ end
171
+
172
+ class PieChart
173
+ include ::Thrift::Struct, ::Thrift::Struct_Union
174
+ TITLE = 1
175
+ SERIES = 2
176
+
177
+ FIELDS = {
178
+ TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
179
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::PieSeries}}
180
+ }
181
+
182
+ def struct_fields; FIELDS; end
183
+
184
+ def validate
185
+ end
186
+
187
+ ::Thrift::Struct.generate_accessors self
188
+ end
189
+
190
+ class LineSeries
191
+ include ::Thrift::Struct, ::Thrift::Struct_Union
192
+ NAME = 1
193
+ POINTS = 2
194
+ TYPE = 3
195
+
196
+ FIELDS = {
197
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
198
+ POINTS => {:type => ::Thrift::Types::LIST, :name => 'points', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Point}},
199
+ TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :default => 0, :enum_class => ::Radar::API::LineSeriesType}
200
+ }
201
+
202
+ def struct_fields; FIELDS; end
203
+
204
+ def validate
205
+ unless @type.nil? || ::Radar::API::LineSeriesType::VALID_VALUES.include?(@type)
206
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
207
+ end
208
+ end
209
+
210
+ ::Thrift::Struct.generate_accessors self
211
+ end
212
+
213
+ class LineChartOptions
214
+ include ::Thrift::Struct, ::Thrift::Struct_Union
215
+ STACKED = 1
216
+ COMPARE = 2
217
+
218
+ FIELDS = {
219
+ STACKED => {:type => ::Thrift::Types::BOOL, :name => 'stacked'},
220
+ COMPARE => {:type => ::Thrift::Types::BOOL, :name => 'compare'}
221
+ }
222
+
223
+ def struct_fields; FIELDS; end
224
+
225
+ def validate
226
+ end
227
+
228
+ ::Thrift::Struct.generate_accessors self
229
+ end
230
+
231
+ class LineChart
232
+ include ::Thrift::Struct, ::Thrift::Struct_Union
233
+ TITLE = 1
234
+ SERIES = 2
235
+ OPTIONS = 3
236
+
237
+ FIELDS = {
238
+ TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
239
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::LineSeries}},
240
+ OPTIONS => {:type => ::Thrift::Types::STRUCT, :name => 'options', :class => ::Radar::API::LineChartOptions}
241
+ }
242
+
243
+ def struct_fields; FIELDS; end
244
+
245
+ def validate
246
+ end
247
+
248
+ ::Thrift::Struct.generate_accessors self
249
+ end
250
+
251
+ class BarSeries
252
+ include ::Thrift::Struct, ::Thrift::Struct_Union
253
+ NAME = 1
254
+ DATA = 2
255
+
256
+ FIELDS = {
257
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
258
+ DATA => {:type => ::Thrift::Types::LIST, :name => 'data', :element => {:type => ::Thrift::Types::DOUBLE}}
259
+ }
260
+
261
+ def struct_fields; FIELDS; end
262
+
263
+ def validate
264
+ end
265
+
266
+ ::Thrift::Struct.generate_accessors self
267
+ end
268
+
269
+ class BarChart
270
+ include ::Thrift::Struct, ::Thrift::Struct_Union
271
+ TITLE = 1
272
+ SERIES = 2
273
+ CATEGORIES = 3
274
+
275
+ FIELDS = {
276
+ TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
277
+ SERIES => {:type => ::Thrift::Types::LIST, :name => 'series', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::BarSeries}},
278
+ CATEGORIES => {:type => ::Thrift::Types::LIST, :name => 'categories', :element => {:type => ::Thrift::Types::STRING}}
279
+ }
280
+
281
+ def struct_fields; FIELDS; end
282
+
283
+ def validate
284
+ end
285
+
286
+ ::Thrift::Struct.generate_accessors self
287
+ end
288
+
289
+ class Text
290
+ include ::Thrift::Struct, ::Thrift::Struct_Union
291
+ TITLE = 1
292
+ CONTENT = 2
293
+
294
+ FIELDS = {
295
+ TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
296
+ CONTENT => {:type => ::Thrift::Types::STRING, :name => 'content'}
297
+ }
298
+
299
+ def struct_fields; FIELDS; end
300
+
301
+ def validate
302
+ end
303
+
304
+ ::Thrift::Struct.generate_accessors self
305
+ end
306
+
307
+ class TableCellContent < ::Thrift::Union
308
+ include ::Thrift::Struct_Union
309
+ class << self
310
+ def text(val)
311
+ TableCellContent.new(:text, val)
312
+ end
313
+
314
+ def percent(val)
315
+ TableCellContent.new(:percent, val)
316
+ end
317
+
318
+ def currency(val)
319
+ TableCellContent.new(:currency, val)
320
+ end
321
+ end
322
+
323
+ TEXT = 1
324
+ PERCENT = 2
325
+ CURRENCY = 3
326
+
327
+ FIELDS = {
328
+ TEXT => {:type => ::Thrift::Types::STRING, :name => 'text'},
329
+ PERCENT => {:type => ::Thrift::Types::DOUBLE, :name => 'percent'},
330
+ CURRENCY => {:type => ::Thrift::Types::DOUBLE, :name => 'currency'}
331
+ }
332
+
333
+ def struct_fields; FIELDS; end
334
+
335
+ def validate
336
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
337
+ end
338
+
339
+ ::Thrift::Union.generate_accessors self
340
+ end
341
+
342
+ class TableCellFormat
343
+ include ::Thrift::Struct, ::Thrift::Struct_Union
344
+ BOLD = 1
345
+ ITALIC = 2
346
+ COLOR = 3
347
+ COLSPAN = 4
348
+ ROWSPAN = 5
349
+
350
+ FIELDS = {
351
+ BOLD => {:type => ::Thrift::Types::BOOL, :name => 'bold'},
352
+ ITALIC => {:type => ::Thrift::Types::BOOL, :name => 'italic'},
353
+ COLOR => {:type => ::Thrift::Types::I32, :name => 'color'},
354
+ COLSPAN => {:type => ::Thrift::Types::I16, :name => 'colspan', :default => 1},
355
+ ROWSPAN => {:type => ::Thrift::Types::I16, :name => 'rowspan', :default => 1}
356
+ }
357
+
358
+ def struct_fields; FIELDS; end
359
+
360
+ def validate
361
+ end
362
+
363
+ ::Thrift::Struct.generate_accessors self
364
+ end
365
+
366
+ class TableCell
367
+ include ::Thrift::Struct, ::Thrift::Struct_Union
368
+ CONTENT = 1
369
+ FORMAT = 2
370
+
371
+ FIELDS = {
372
+ CONTENT => {:type => ::Thrift::Types::STRUCT, :name => 'content', :class => ::Radar::API::TableCellContent},
373
+ FORMAT => {:type => ::Thrift::Types::STRUCT, :name => 'format', :class => ::Radar::API::TableCellFormat}
374
+ }
375
+
376
+ def struct_fields; FIELDS; end
377
+
378
+ def validate
379
+ end
380
+
381
+ ::Thrift::Struct.generate_accessors self
382
+ end
383
+
384
+ class TableRow
385
+ include ::Thrift::Struct, ::Thrift::Struct_Union
386
+ CELLS = 1
387
+
388
+ FIELDS = {
389
+ CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableCell}}
390
+ }
391
+
392
+ def struct_fields; FIELDS; end
393
+
394
+ def validate
395
+ end
396
+
397
+ ::Thrift::Struct.generate_accessors self
398
+ end
399
+
400
+ class Table
401
+ include ::Thrift::Struct, ::Thrift::Struct_Union
402
+ TITLE = 1
403
+ HEADER = 2
404
+ BODY = 3
405
+ FOOTER = 4
406
+
407
+ FIELDS = {
408
+ TITLE => {:type => ::Thrift::Types::STRING, :name => 'title'},
409
+ HEADER => {:type => ::Thrift::Types::LIST, :name => 'header', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}},
410
+ BODY => {:type => ::Thrift::Types::LIST, :name => 'body', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}},
411
+ FOOTER => {:type => ::Thrift::Types::LIST, :name => 'footer', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::TableRow}}
412
+ }
413
+
414
+ def struct_fields; FIELDS; end
415
+
416
+ def validate
417
+ end
418
+
419
+ ::Thrift::Struct.generate_accessors self
420
+ end
421
+
422
+ class Result < ::Thrift::Union
423
+ include ::Thrift::Struct_Union
424
+ class << self
425
+ def table(val)
426
+ Result.new(:table, val)
427
+ end
428
+
429
+ def pie_chart(val)
430
+ Result.new(:pie_chart, val)
431
+ end
432
+
433
+ def line_chart(val)
434
+ Result.new(:line_chart, val)
435
+ end
436
+
437
+ def bar_chart(val)
438
+ Result.new(:bar_chart, val)
439
+ end
440
+ end
441
+
442
+ TABLE = 1
443
+ PIE_CHART = 2
444
+ LINE_CHART = 3
445
+ BAR_CHART = 4
446
+
447
+ FIELDS = {
448
+ TABLE => {:type => ::Thrift::Types::STRUCT, :name => 'table', :class => ::Radar::API::Table},
449
+ PIE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'pie_chart', :class => ::Radar::API::PieChart},
450
+ LINE_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'line_chart', :class => ::Radar::API::LineChart},
451
+ BAR_CHART => {:type => ::Thrift::Types::STRUCT, :name => 'bar_chart', :class => ::Radar::API::BarChart}
452
+ }
453
+
454
+ def struct_fields; FIELDS; end
455
+
456
+ def validate
457
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
458
+ end
459
+
460
+ ::Thrift::Union.generate_accessors self
461
+ end
462
+
463
+ class Position
464
+ include ::Thrift::Struct, ::Thrift::Struct_Union
465
+ ID = 1
466
+ VALUE = 2
467
+ RENTABILITY = 3
468
+
469
+ FIELDS = {
470
+ ID => {:type => ::Thrift::Types::STRUCT, :name => 'id', :class => ::Radar::API::SecurityId},
471
+ VALUE => {:type => ::Thrift::Types::DOUBLE, :name => 'value'},
472
+ RENTABILITY => {:type => ::Thrift::Types::DOUBLE, :name => 'rentability'}
473
+ }
474
+
475
+ def struct_fields; FIELDS; end
476
+
477
+ def validate
478
+ end
479
+
480
+ ::Thrift::Struct.generate_accessors self
481
+ end
482
+
483
+ class Portfolio
484
+ include ::Thrift::Struct, ::Thrift::Struct_Union
485
+ DATE = 1
486
+ RENTABILITY = 2
487
+ NAV = 3
488
+ POSITIONS = 4
489
+
490
+ FIELDS = {
491
+ DATE => {:type => ::Thrift::Types::I32, :name => 'date'},
492
+ RENTABILITY => {:type => ::Thrift::Types::DOUBLE, :name => 'rentability'},
493
+ NAV => {:type => ::Thrift::Types::DOUBLE, :name => 'nav'},
494
+ POSITIONS => {:type => ::Thrift::Types::MAP, :name => 'positions', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::API::Position}}
495
+ }
496
+
497
+ def struct_fields; FIELDS; end
498
+
499
+ def validate
500
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field date is unset!') unless @date
501
+ end
502
+
503
+ ::Thrift::Struct.generate_accessors self
504
+ end
505
+
506
+ class AnalyzerConfig
507
+ include ::Thrift::Struct, ::Thrift::Struct_Union
508
+ RESULT_TYPE = 1
509
+ ACCEPTED_EVENTS = 2
510
+
511
+ FIELDS = {
512
+ RESULT_TYPE => {:type => ::Thrift::Types::I32, :name => 'result_type', :enum_class => ::Radar::API::ResultType},
513
+ ACCEPTED_EVENTS => {:type => ::Thrift::Types::SET, :name => 'accepted_events', :element => {:type => ::Thrift::Types::I32, :enum_class => ::Radar::API::Event}}
514
+ }
515
+
516
+ def struct_fields; FIELDS; end
517
+
518
+ def validate
519
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field result_type is unset!') unless @result_type
520
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field accepted_events is unset!') unless @accepted_events
521
+ unless @result_type.nil? || ::Radar::API::ResultType::VALID_VALUES.include?(@result_type)
522
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field result_type!')
523
+ end
524
+ end
525
+
526
+ ::Thrift::Struct.generate_accessors self
527
+ end
528
+
529
+ end
530
+ end
@@ -0,0 +1,5 @@
1
+ module Radar
2
+ module API
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
data/lib/radar-api.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'radar/api/version'
2
+ require 'radar/api/analyzer_controller'
3
+ require 'radar/api/fund_service'
4
+ require 'radar/api/radar_constants'
5
+ require 'radar/api/radar_types'
@@ -0,0 +1 @@
1
+ require 'radar/api/radar_types'
data/radar-api.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'radar/api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "radar-api"
8
+ spec.version = Radar::API::VERSION
9
+ spec.authors = ["André Aizim Kelmanson"]
10
+ spec.email = ["andre@investtools.com.br"]
11
+ spec.summary = %q{Radar API}
12
+ spec.description = %q{Radar API}
13
+ spec.homepage = "http://www.investtools.com.br/"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "thrift"
24
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radar-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - André Aizim Kelmanson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thrift
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Radar API
56
+ email:
57
+ - andre@investtools.com.br
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - Gemfile
63
+ - Gemfile.lock
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/radar-api.rb
68
+ - lib/radar/api/analyzer_controller.rb
69
+ - lib/radar/api/fund_service.rb
70
+ - lib/radar/api/radar_constants.rb
71
+ - lib/radar/api/radar_types.rb
72
+ - lib/radar/api/version.rb
73
+ - lib/radar_types.rb
74
+ - radar-api.gemspec
75
+ homepage: http://www.investtools.com.br/
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.2.1
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Radar API
99
+ test_files: []