finapps 0.12.5.pre → 0.13.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/finapps.rb +3 -0
- data/lib/finapps/rest/alert.rb +50 -0
- data/lib/finapps/rest/alert_definition.rb +46 -0
- data/lib/finapps/rest/alert_setting.rb +46 -0
- data/lib/finapps/rest/client.rb +5 -1
- data/lib/finapps/rest/defaults.rb +8 -12
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +4 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aabd3723383e152eac1916488fc404775b9f008
|
4
|
+
data.tar.gz: 2c475caedbf8426b987727e81bf1e93a523dc242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dc414cf0b243fe18110f12fc1bdb4a8bb0993ef4c1b8909c377650f334dc163732389debe5c3cb25447b384387bb013cdc0df35fb4d8ec40245fbc691256d50
|
7
|
+
data.tar.gz: 072cc09d3bb15d1ad0e9879cf22cbd752860fd380bccd982adcb42aed2d10bd60eec2d2d679e554d97416de4af9a9513d751000c0cde273b4dc49ecb75399d20
|
data/lib/finapps.rb
CHANGED
@@ -28,6 +28,9 @@ require 'finapps/rest/budget_models'
|
|
28
28
|
require 'finapps/rest/budget_calculation'
|
29
29
|
require 'finapps/rest/budget'
|
30
30
|
require 'finapps/rest/cashflow'
|
31
|
+
require 'finapps/rest/alert'
|
32
|
+
require 'finapps/rest/alert_definition'
|
33
|
+
require 'finapps/rest/alert_setting'
|
31
34
|
|
32
35
|
require 'finapps/rest/connection'
|
33
36
|
require 'finapps/rest/client'
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module FinApps
|
2
|
+
module REST
|
3
|
+
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class Alert < FinApps::REST::Resources
|
7
|
+
include FinApps::REST::Defaults
|
8
|
+
|
9
|
+
# @return [Hash, Array<String>]
|
10
|
+
def list(page = 1, requested=100, sort='date', asc=false, read=false)
|
11
|
+
logger.debug "##{__method__.to_s} => Started"
|
12
|
+
|
13
|
+
end_point = Defaults::END_POINTS[:alert_list]
|
14
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
|
+
|
16
|
+
path = end_point.sub ':page', ERB::Util.url_encode(page)
|
17
|
+
path = path.sub ':requested', ERB::Util.url_encode(requested)
|
18
|
+
path = path.sub ':sort', ERB::Util.url_encode(sort)
|
19
|
+
path = path.sub ':asc', ERB::Util.url_encode(asc)
|
20
|
+
path = path.sub ':read', ERB::Util.url_encode(read)
|
21
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
22
|
+
|
23
|
+
result, error_messages = @client.send(path, :get)
|
24
|
+
|
25
|
+
logger.debug "##{__method__.to_s} => Completed"
|
26
|
+
return result, error_messages
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Hash, Array<String>]
|
30
|
+
def update(params)
|
31
|
+
logger.debug "##{__method__.to_s} => Started"
|
32
|
+
|
33
|
+
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
34
|
+
logger.debug "##{__method__.to_s} => params: #{params.inspect}"
|
35
|
+
|
36
|
+
end_point = Defaults::END_POINTS[:alert_update]
|
37
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
38
|
+
|
39
|
+
path = end_point
|
40
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
41
|
+
|
42
|
+
_, error_messages = @client.send(path, :put, params.compact)
|
43
|
+
|
44
|
+
logger.debug "##{__method__.to_s} => Completed"
|
45
|
+
error_messages
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module FinApps
|
2
|
+
module REST
|
3
|
+
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class AlertDefinition < FinApps::REST::Resources
|
7
|
+
include FinApps::REST::Defaults
|
8
|
+
|
9
|
+
# @return [Hash, Array<String>]
|
10
|
+
def list
|
11
|
+
logger.debug "##{__method__.to_s} => Started"
|
12
|
+
|
13
|
+
end_point = Defaults::END_POINTS[:alert_definition_list]
|
14
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
|
+
|
16
|
+
path = end_point
|
17
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
18
|
+
|
19
|
+
result, error_messages = @client.send(path, :get)
|
20
|
+
|
21
|
+
logger.debug "##{__method__.to_s} => Completed"
|
22
|
+
return result, error_messages
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Hash, Array<String>]
|
26
|
+
def show(alert_name)
|
27
|
+
logger.debug "##{__method__.to_s} => Started"
|
28
|
+
|
29
|
+
raise MissingArgumentsError.new 'Missing argument: alert_name.' if alert_name.blank?
|
30
|
+
logger.debug "##{__method__.to_s} => alert_name: #{alert_name}"
|
31
|
+
|
32
|
+
end_point = Defaults::END_POINTS[:alert_definition_show]
|
33
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
34
|
+
|
35
|
+
path = end_point.sub ':alert_name', ERB::Util.url_encode(alert_name)
|
36
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
37
|
+
|
38
|
+
result, error_messages = @client.send(path, :get)
|
39
|
+
|
40
|
+
logger.debug "##{__method__.to_s} => Completed"
|
41
|
+
return result, error_messages
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module FinApps
|
2
|
+
module REST
|
3
|
+
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
class AlertSetting < FinApps::REST::Resources
|
7
|
+
include FinApps::REST::Defaults
|
8
|
+
|
9
|
+
# @return [Hash, Array<String>]
|
10
|
+
def list
|
11
|
+
logger.debug "##{__method__.to_s} => Started"
|
12
|
+
|
13
|
+
end_point = Defaults::END_POINTS[:alert_setting_list]
|
14
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
|
+
|
16
|
+
path = end_point
|
17
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
18
|
+
|
19
|
+
result, error_messages = @client.send(path, :get)
|
20
|
+
|
21
|
+
logger.debug "##{__method__.to_s} => Completed"
|
22
|
+
return result, error_messages
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Hash, Array<String>]
|
26
|
+
def update(params)
|
27
|
+
logger.debug "##{__method__.to_s} => Started"
|
28
|
+
|
29
|
+
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
30
|
+
logger.debug "##{__method__.to_s} => params: #{params.inspect}"
|
31
|
+
|
32
|
+
end_point = Defaults::END_POINTS[:alert_setting_update]
|
33
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
34
|
+
|
35
|
+
path = end_point
|
36
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
37
|
+
|
38
|
+
_, error_messages = @client.send(path, :put, params.compact)
|
39
|
+
|
40
|
+
logger.debug "##{__method__.to_s} => Completed"
|
41
|
+
error_messages
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -7,7 +7,8 @@ module FinApps
|
|
7
7
|
|
8
8
|
attr_reader :connection, :users, :institutions, :user_institutions,
|
9
9
|
:transactions, :categories,
|
10
|
-
:budget_models, :budget_calculation, :budget, :cashflow
|
10
|
+
:budget_models, :budget_calculation, :budget, :cashflow,
|
11
|
+
:alert, :alert_definition, :alert_setting
|
11
12
|
|
12
13
|
# @param [String] company_identifier
|
13
14
|
# @param [String] company_token
|
@@ -201,6 +202,9 @@ module FinApps
|
|
201
202
|
@budget_calculation ||= FinApps::REST::BudgetCalculation.new self
|
202
203
|
@budget ||= FinApps::REST::Budget.new self
|
203
204
|
@cashflow ||= FinApps::REST::Cashflow.new self
|
205
|
+
@alert ||= FinApps::REST::Alert.new self
|
206
|
+
@alert_definition ||= FinApps::REST::AlertDefinition.new self
|
207
|
+
@alert_setting ||= FinApps::REST::AlertSetting.new self
|
204
208
|
end
|
205
209
|
|
206
210
|
end
|
@@ -57,21 +57,17 @@ module FinApps
|
|
57
57
|
|
58
58
|
:cashflow_show => 'cashflow/:start_date/:end_date',
|
59
59
|
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:geo_postal_record_by_region => 'geo/maxmind/postal/:region/:city',
|
63
|
-
:geo_postal_record_by_postal_code => 'geo/maxmind/postal/:postal',
|
64
|
-
:geo_us_record_by_region => 'geo/us/region/:region/:city',
|
60
|
+
:alert_list => 'alerts/:page/:requested/:sort/:asc/:read',
|
61
|
+
:alert_update => 'alerts',
|
65
62
|
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:relevance_rulesets_run => 'relevance/run',
|
63
|
+
:alert_definition_list => 'alerts/definitions',
|
64
|
+
:alert_definition_show => 'alerts/definitions/:alert_name',
|
69
65
|
|
70
|
-
:
|
71
|
-
:
|
66
|
+
:alert_setting_list => 'alerts/settings',
|
67
|
+
:alert_setting_update => 'alerts/settings',
|
72
68
|
|
73
|
-
:
|
74
|
-
:
|
69
|
+
:alert_preference_list => 'alerts/preferences',
|
70
|
+
:alert_preference_update => 'alerts/preferences'
|
75
71
|
|
76
72
|
|
77
73
|
}.freeze
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -18,7 +18,10 @@ module FinApps
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'responds to public api methods' do
|
21
|
-
[:
|
21
|
+
[:alert, :alert_definition, :alert_setting,
|
22
|
+
:budget, :budget_calculation, :budget_models, :cashflow,
|
23
|
+
:categories, :institutions, :transactions,
|
24
|
+
:user_institutions, :users].each do |method|
|
22
25
|
expect(@client).to respond_to(method)
|
23
26
|
end
|
24
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -197,6 +197,9 @@ files:
|
|
197
197
|
- lib/finapps/middleware/api_token.rb
|
198
198
|
- lib/finapps/middleware/raise_http_exceptions.rb
|
199
199
|
- lib/finapps/middleware/response_logger.rb
|
200
|
+
- lib/finapps/rest/alert.rb
|
201
|
+
- lib/finapps/rest/alert_definition.rb
|
202
|
+
- lib/finapps/rest/alert_setting.rb
|
200
203
|
- lib/finapps/rest/budget.rb
|
201
204
|
- lib/finapps/rest/budget_calculation.rb
|
202
205
|
- lib/finapps/rest/budget_models.rb
|