radar-api 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,140 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.12.0)
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/data_server_types'
9
+
10
+ module Radar
11
+ module Api
12
+ module PortfolioService
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def run_portfolio(trxs, reports_dates, user)
17
+ send_run_portfolio(trxs, reports_dates, user)
18
+ return recv_run_portfolio()
19
+ end
20
+
21
+ def send_run_portfolio(trxs, reports_dates, user)
22
+ send_message('run_portfolio', Run_portfolio_args, :trxs => trxs, :reports_dates => reports_dates, :user => user)
23
+ end
24
+
25
+ def recv_run_portfolio()
26
+ result = receive_message(Run_portfolio_result)
27
+ return result.success unless result.success.nil?
28
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'run_portfolio failed: unknown result')
29
+ end
30
+
31
+ def persist(trxs, user)
32
+ send_persist(trxs, user)
33
+ recv_persist()
34
+ end
35
+
36
+ def send_persist(trxs, user)
37
+ send_message('persist', Persist_args, :trxs => trxs, :user => user)
38
+ end
39
+
40
+ def recv_persist()
41
+ result = receive_message(Persist_result)
42
+ return
43
+ end
44
+
45
+ end
46
+
47
+ class Processor
48
+ include ::Thrift::Processor
49
+
50
+ def process_run_portfolio(seqid, iprot, oprot)
51
+ args = read_args(iprot, Run_portfolio_args)
52
+ result = Run_portfolio_result.new()
53
+ result.success = @handler.run_portfolio(args.trxs, args.reports_dates, args.user)
54
+ write_result(result, oprot, 'run_portfolio', seqid)
55
+ end
56
+
57
+ def process_persist(seqid, iprot, oprot)
58
+ args = read_args(iprot, Persist_args)
59
+ result = Persist_result.new()
60
+ @handler.persist(args.trxs, args.user)
61
+ write_result(result, oprot, 'persist', seqid)
62
+ end
63
+
64
+ end
65
+
66
+ # HELPER FUNCTIONS AND STRUCTURES
67
+
68
+ class Run_portfolio_args
69
+ include ::Thrift::Struct, ::Thrift::Struct_Union
70
+ TRXS = 1
71
+ REPORTS_DATES = 2
72
+ USER = 3
73
+
74
+ FIELDS = {
75
+ TRXS => {:type => ::Thrift::Types::LIST, :name => 'trxs', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Transaction}},
76
+ REPORTS_DATES => {:type => ::Thrift::Types::LIST, :name => 'reports_dates', :element => {:type => ::Thrift::Types::I64}},
77
+ USER => {:type => ::Thrift::Types::STRING, :name => 'user'}
78
+ }
79
+
80
+ def struct_fields; FIELDS; end
81
+
82
+ def validate
83
+ end
84
+
85
+ ::Thrift::Struct.generate_accessors self
86
+ end
87
+
88
+ class Run_portfolio_result
89
+ include ::Thrift::Struct, ::Thrift::Struct_Union
90
+ SUCCESS = 0
91
+
92
+ FIELDS = {
93
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::MonthlyPosition}}
94
+ }
95
+
96
+ def struct_fields; FIELDS; end
97
+
98
+ def validate
99
+ end
100
+
101
+ ::Thrift::Struct.generate_accessors self
102
+ end
103
+
104
+ class Persist_args
105
+ include ::Thrift::Struct, ::Thrift::Struct_Union
106
+ TRXS = 1
107
+ USER = 2
108
+
109
+ FIELDS = {
110
+ TRXS => {:type => ::Thrift::Types::LIST, :name => 'trxs', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Transaction}},
111
+ USER => {:type => ::Thrift::Types::STRING, :name => 'user'}
112
+ }
113
+
114
+ def struct_fields; FIELDS; end
115
+
116
+ def validate
117
+ end
118
+
119
+ ::Thrift::Struct.generate_accessors self
120
+ end
121
+
122
+ class Persist_result
123
+ include ::Thrift::Struct, ::Thrift::Struct_Union
124
+
125
+ FIELDS = {
126
+
127
+ }
128
+
129
+ def struct_fields; FIELDS; end
130
+
131
+ def validate
132
+ end
133
+
134
+ ::Thrift::Struct.generate_accessors self
135
+ end
136
+
137
+ end
138
+
139
+ end
140
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.3)
2
+ # Autogenerated by Thrift Compiler (0.12.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.12.0)
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_types'
9
+
10
+ module Radar
11
+ module Api
12
+ end
13
+ end
@@ -0,0 +1,89 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.12.0)
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_file_importer_types'
9
+
10
+ module Radar
11
+ module Api
12
+ module TransactionFileImporter
13
+ class Client
14
+ include ::Thrift::Client
15
+
16
+ def extract(data)
17
+ send_extract(data)
18
+ return recv_extract()
19
+ end
20
+
21
+ def send_extract(data)
22
+ send_message('extract', Extract_args, :data => data)
23
+ end
24
+
25
+ def recv_extract()
26
+ result = receive_message(Extract_result)
27
+ return result.success unless result.success.nil?
28
+ raise result.col_quantity_error unless result.col_quantity_error.nil?
29
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'extract failed: unknown result')
30
+ end
31
+
32
+ end
33
+
34
+ class Processor
35
+ include ::Thrift::Processor
36
+
37
+ def process_extract(seqid, iprot, oprot)
38
+ args = read_args(iprot, Extract_args)
39
+ result = Extract_result.new()
40
+ begin
41
+ result.success = @handler.extract(args.data)
42
+ rescue ::Radar::Api::WrongFileStructure => col_quantity_error
43
+ result.col_quantity_error = col_quantity_error
44
+ end
45
+ write_result(result, oprot, 'extract', seqid)
46
+ end
47
+
48
+ end
49
+
50
+ # HELPER FUNCTIONS AND STRUCTURES
51
+
52
+ class Extract_args
53
+ include ::Thrift::Struct, ::Thrift::Struct_Union
54
+ DATA = 1
55
+
56
+ FIELDS = {
57
+ DATA => {:type => ::Thrift::Types::STRING, :name => 'data'}
58
+ }
59
+
60
+ def struct_fields; FIELDS; end
61
+
62
+ def validate
63
+ end
64
+
65
+ ::Thrift::Struct.generate_accessors self
66
+ end
67
+
68
+ class Extract_result
69
+ include ::Thrift::Struct, ::Thrift::Struct_Union
70
+ SUCCESS = 0
71
+ COL_QUANTITY_ERROR = 1
72
+
73
+ FIELDS = {
74
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Transaction}},
75
+ COL_QUANTITY_ERROR => {:type => ::Thrift::Types::STRUCT, :name => 'col_quantity_error', :class => ::Radar::Api::WrongFileStructure}
76
+ }
77
+
78
+ def struct_fields; FIELDS; end
79
+
80
+ def validate
81
+ end
82
+
83
+ ::Thrift::Struct.generate_accessors self
84
+ end
85
+
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.12.0)
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_file_importer_types'
9
+
10
+ module Radar
11
+ module Api
12
+ end
13
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (0.12.0)
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_types'
9
+
10
+
11
+ module Radar
12
+ module Api
13
+ class WrongFileStructure < ::Thrift::Exception; end
14
+
15
+ class WrongFileStructure < ::Thrift::Exception
16
+ include ::Thrift::Struct, ::Thrift::Struct_Union
17
+ def initialize(message=nil)
18
+ super()
19
+ self.message = message
20
+ end
21
+
22
+ MESSAGE = 1
23
+
24
+ FIELDS = {
25
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
26
+ }
27
+
28
+ def struct_fields; FIELDS; end
29
+
30
+ def validate
31
+ end
32
+
33
+ ::Thrift::Struct.generate_accessors self
34
+ end
35
+
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.3)
2
+ # Autogenerated by Thrift Compiler (0.12.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -13,51 +13,20 @@ module Radar
13
13
  class Client
14
14
  include ::Thrift::Client
15
15
 
16
- def name()
17
- send_name()
18
- return recv_name()
16
+ def fetch(username, password, user, last_transaction_date)
17
+ send_fetch(username, password, user, last_transaction_date)
18
+ recv_fetch()
19
19
  end
20
20
 
21
- def send_name()
22
- send_message('name', Name_args)
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
- def accounts(username, password)
32
- send_accounts(username, password)
33
- return recv_accounts()
34
- end
35
-
36
- def send_accounts(username, password)
37
- send_message('accounts', Accounts_args, :username => username, :password => password)
38
- end
39
-
40
- def recv_accounts()
41
- result = receive_message(Accounts_result)
42
- return result.success unless result.success.nil?
43
- raise result.auth_error unless result.auth_error.nil?
44
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'accounts failed: unknown result')
45
- end
46
-
47
- def fetch(username, password, accounts)
48
- send_fetch(username, password, accounts)
49
- return recv_fetch()
50
- end
51
-
52
- def send_fetch(username, password, accounts)
53
- send_message('fetch', Fetch_args, :username => username, :password => password, :accounts => accounts)
21
+ def send_fetch(username, password, user, last_transaction_date)
22
+ send_message('fetch', Fetch_args, :username => username, :password => password, :user => user, :last_transaction_date => last_transaction_date)
54
23
  end
55
24
 
56
25
  def recv_fetch()
57
26
  result = receive_message(Fetch_result)
58
- return result.success unless result.success.nil?
59
27
  raise result.auth_error unless result.auth_error.nil?
60
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fetch failed: unknown result')
28
+ raise result.system_unavailable unless result.system_unavailable.nil?
29
+ return
61
30
  end
62
31
 
63
32
  end
@@ -65,31 +34,15 @@ module Radar
65
34
  class Processor
66
35
  include ::Thrift::Processor
67
36
 
68
- def process_name(seqid, iprot, oprot)
69
- args = read_args(iprot, Name_args)
70
- result = Name_result.new()
71
- result.success = @handler.name()
72
- write_result(result, oprot, 'name', seqid)
73
- end
74
-
75
- def process_accounts(seqid, iprot, oprot)
76
- args = read_args(iprot, Accounts_args)
77
- result = Accounts_result.new()
78
- begin
79
- result.success = @handler.accounts(args.username, args.password)
80
- rescue ::Radar::Api::AuthenticationError => auth_error
81
- result.auth_error = auth_error
82
- end
83
- write_result(result, oprot, 'accounts', seqid)
84
- end
85
-
86
37
  def process_fetch(seqid, iprot, oprot)
87
38
  args = read_args(iprot, Fetch_args)
88
39
  result = Fetch_result.new()
89
40
  begin
90
- result.success = @handler.fetch(args.username, args.password, args.accounts)
41
+ @handler.fetch(args.username, args.password, args.user, args.last_transaction_date)
91
42
  rescue ::Radar::Api::AuthenticationError => auth_error
92
43
  result.auth_error = auth_error
44
+ rescue ::Radar::Api::SystemUnavailableError => system_unavailable
45
+ result.system_unavailable = system_unavailable
93
46
  end
94
47
  write_result(result, oprot, 'fetch', seqid)
95
48
  end
@@ -98,83 +51,18 @@ module Radar
98
51
 
99
52
  # HELPER FUNCTIONS AND STRUCTURES
100
53
 
101
- class Name_args
102
- include ::Thrift::Struct, ::Thrift::Struct_Union
103
-
104
- FIELDS = {
105
-
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 Name_result
117
- include ::Thrift::Struct, ::Thrift::Struct_Union
118
- SUCCESS = 0
119
-
120
- FIELDS = {
121
- SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}
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
- class Accounts_args
133
- include ::Thrift::Struct, ::Thrift::Struct_Union
134
- USERNAME = 1
135
- PASSWORD = 2
136
-
137
- FIELDS = {
138
- USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'},
139
- PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password'}
140
- }
141
-
142
- def struct_fields; FIELDS; end
143
-
144
- def validate
145
- end
146
-
147
- ::Thrift::Struct.generate_accessors self
148
- end
149
-
150
- class Accounts_result
151
- include ::Thrift::Struct, ::Thrift::Struct_Union
152
- SUCCESS = 0
153
- AUTH_ERROR = 1
154
-
155
- FIELDS = {
156
- SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
157
- AUTH_ERROR => {:type => ::Thrift::Types::STRUCT, :name => 'auth_error', :class => ::Radar::Api::AuthenticationError}
158
- }
159
-
160
- def struct_fields; FIELDS; end
161
-
162
- def validate
163
- end
164
-
165
- ::Thrift::Struct.generate_accessors self
166
- end
167
-
168
54
  class Fetch_args
169
55
  include ::Thrift::Struct, ::Thrift::Struct_Union
170
56
  USERNAME = 1
171
57
  PASSWORD = 2
172
- ACCOUNTS = 3
58
+ USER = 3
59
+ LAST_TRANSACTION_DATE = 4
173
60
 
174
61
  FIELDS = {
175
62
  USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username'},
176
63
  PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password'},
177
- ACCOUNTS => {:type => ::Thrift::Types::LIST, :name => 'accounts', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Account}}
64
+ USER => {:type => ::Thrift::Types::STRING, :name => 'user'},
65
+ LAST_TRANSACTION_DATE => {:type => ::Thrift::Types::I64, :name => 'last_transaction_date'}
178
66
  }
179
67
 
180
68
  def struct_fields; FIELDS; end
@@ -187,12 +75,12 @@ module Radar
187
75
 
188
76
  class Fetch_result
189
77
  include ::Thrift::Struct, ::Thrift::Struct_Union
190
- SUCCESS = 0
191
78
  AUTH_ERROR = 1
79
+ SYSTEM_UNAVAILABLE = 2
192
80
 
193
81
  FIELDS = {
194
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Radar::Api::Transaction}},
195
- AUTH_ERROR => {:type => ::Thrift::Types::STRUCT, :name => 'auth_error', :class => ::Radar::Api::AuthenticationError}
82
+ AUTH_ERROR => {:type => ::Thrift::Types::STRUCT, :name => 'auth_error', :class => ::Radar::Api::AuthenticationError},
83
+ SYSTEM_UNAVAILABLE => {:type => ::Thrift::Types::STRUCT, :name => 'system_unavailable', :class => ::Radar::Api::SystemUnavailableError}
196
84
  }
197
85
 
198
86
  def struct_fields; FIELDS; end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.3)
2
+ # Autogenerated by Thrift Compiler (0.12.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.3)
2
+ # Autogenerated by Thrift Compiler (0.12.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -10,103 +10,21 @@ require 'radar/api/common_types'
10
10
 
11
11
  module Radar
12
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
- ACCOUNT = 2
24
- STOCK = 3
25
- SHARES = 4
26
- PRICE = 5
27
-
28
- FIELDS = {
29
- DATE => {:type => ::Thrift::Types::I64, :name => 'date'},
30
- ACCOUNT => {:type => ::Thrift::Types::STRING, :name => 'account'},
31
- STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::Api::StockId},
32
- SHARES => {:type => ::Thrift::Types::I32, :name => 'shares'},
33
- PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'price'}
34
- }
13
+ class AuthenticationError < ::Thrift::Exception; end
35
14
 
36
- def struct_fields; FIELDS; end
37
-
38
- def validate
39
- end
15
+ class SystemUnavailableError < ::Thrift::Exception; end
40
16
 
41
- ::Thrift::Struct.generate_accessors self
42
- end
43
-
44
- class StockBuyTransaction
17
+ class AuthenticationError < ::Thrift::Exception
45
18
  include ::Thrift::Struct, ::Thrift::Struct_Union
46
- DATE = 1
47
- ACCOUNT = 2
48
- STOCK = 3
49
- SHARES = 4
50
- PRICE = 5
51
- TYPE = 6
52
-
53
- FIELDS = {
54
- DATE => {:type => ::Thrift::Types::I64, :name => 'date'},
55
- ACCOUNT => {:type => ::Thrift::Types::STRING, :name => 'account'},
56
- STOCK => {:type => ::Thrift::Types::STRUCT, :name => 'stock', :class => ::Radar::Api::StockId},
57
- SHARES => {:type => ::Thrift::Types::I32, :name => 'shares'},
58
- PRICE => {:type => ::Thrift::Types::DOUBLE, :name => 'price'},
59
- TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :default => 1, :enum_class => ::Radar::Api::StockBuyTransactionType}
60
- }
61
-
62
- def struct_fields; FIELDS; end
63
-
64
- def validate
65
- unless @type.nil? || ::Radar::Api::StockBuyTransactionType::VALID_VALUES.include?(@type)
66
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field type!')
67
- end
68
- end
69
-
70
- ::Thrift::Struct.generate_accessors self
71
- end
72
-
73
- class Transaction < ::Thrift::Union
74
- include ::Thrift::Struct_Union
75
- class << self
76
- def stock_buy(val)
77
- Transaction.new(:stock_buy, val)
78
- end
79
-
80
- def stock_sell(val)
81
- Transaction.new(:stock_sell, val)
82
- end
83
- end
84
-
85
- STOCK_BUY = 1
86
- STOCK_SELL = 2
87
-
88
- FIELDS = {
89
- STOCK_BUY => {:type => ::Thrift::Types::STRUCT, :name => 'stock_buy', :class => ::Radar::Api::StockBuyTransaction},
90
- STOCK_SELL => {:type => ::Thrift::Types::STRUCT, :name => 'stock_sell', :class => ::Radar::Api::StockSellTransaction}
91
- }
92
-
93
- def struct_fields; FIELDS; end
94
-
95
- def validate
96
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
19
+ def initialize(message=nil)
20
+ super()
21
+ self.message = message
97
22
  end
98
23
 
99
- ::Thrift::Union.generate_accessors self
100
- end
101
-
102
- class Account
103
- include ::Thrift::Struct, ::Thrift::Struct_Union
104
- ID = 1
105
- LAST_TRANSACTION_DATE = 2
24
+ MESSAGE = 1
106
25
 
107
26
  FIELDS = {
108
- ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
109
- LAST_TRANSACTION_DATE => {:type => ::Thrift::Types::I64, :name => 'last_transaction_date'}
27
+ MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
110
28
  }
111
29
 
112
30
  def struct_fields; FIELDS; end
@@ -117,7 +35,7 @@ module Radar
117
35
  ::Thrift::Struct.generate_accessors self
118
36
  end
119
37
 
120
- class AuthenticationError < ::Thrift::Exception
38
+ class SystemUnavailableError < ::Thrift::Exception
121
39
  include ::Thrift::Struct, ::Thrift::Struct_Union
122
40
  def initialize(message=nil)
123
41
  super()