finapps 0.16.6.pre → 0.17.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b25dc2333bf7dd53e937e6d95e46ee5cd4d44140
4
- data.tar.gz: 28fbf5ff5aa5adda7273004547aef514565697a2
3
+ metadata.gz: 3f88315a419b4a7bcdb11468f98d3ef625eec525
4
+ data.tar.gz: e5880003084936f6c8df8e1f42efab7f36e73bd4
5
5
  SHA512:
6
- metadata.gz: a36153406beb592f616189beff50bd6dd4cbd171f0a33cff0dd86ab8f8224e10937e85532c2a9a8c571323a32a69c4f169c99a187da5aa793db3858a30614ba8
7
- data.tar.gz: c4934ec48e010ea13394a8cf17c04784c3baa6ca5361a0be82c42f6b280b626cd30e8864c6936e78f5e51e1fae9d599490c71936c03156002354ef065898ce61
6
+ metadata.gz: e7730d6a6cc74a2e71bddc116b4013ce06525e53bee43c860562b05c88ae4ea72b5d0b2487138e55ae387194174d653b8e9dd8680bba30a6aa59c1acf29e9e43
7
+ data.tar.gz: 35faa17700b20613a720f9a0e26a797f180c618861007bf3b59d46323c9b8db38811382f355e222a9965a5465c0408a86f4ffa072241b51589a98969451b46f5
data/bin/finapps CHANGED
@@ -4,5 +4,6 @@ require 'finapps/cli/users'
4
4
  require 'finapps/cli/institutions'
5
5
  require 'finapps/cli/budgets'
6
6
  require 'finapps/cli/cashflows'
7
+ require 'finapps/cli/alert_preferences'
7
8
 
8
9
  FinApps::CLI.start
@@ -0,0 +1,65 @@
1
+ require 'thor'
2
+ require 'finapps'
3
+ require 'pp'
4
+
5
+ module FinApps
6
+ class CLI < Thor
7
+
8
+ desc 'alert_preferences', 'show'
9
+
10
+ def alert_preferences_show
11
+
12
+ begin
13
+
14
+ user_identifier = '53d17daf-909d-45d2-6fb6-d43b74d364cb'
15
+ user_token = '4JZmhcHVf3ODRJ9TMKF7N/1sHDY3M5Q49A9ToAy+TDE='
16
+
17
+ client.user_credentials!(user_identifier, user_token)
18
+ alert_preferences, error_messages = client.alert_preferences.show
19
+ if alert_preferences.present?
20
+ puts
21
+ puts 'alert preferences results:'
22
+ pp alert_preferences
23
+ else
24
+ puts
25
+ puts 'unable to get alert preferences'
26
+ error_messages.each { |m| puts m } if error_messages.present?
27
+ end
28
+ puts
29
+
30
+ rescue StandardError => error
31
+ rescue_standard_error(error)
32
+ end
33
+
34
+ end
35
+
36
+ desc 'alert_preferences_update', 'update'
37
+
38
+ def alert_preferences_update
39
+
40
+ begin
41
+
42
+ user_identifier = '53d17daf-909d-45d2-6fb6-d43b74d364cb'
43
+ user_token = '4JZmhcHVf3ODRJ9TMKF7N/1sHDY3M5Q49A9ToAy+TDE='
44
+
45
+ client.user_credentials!(user_identifier, user_token)
46
+ alert_preferences, error_messages = client.alert_preferences.update({:emails => ['user@domain.com'], :phones => ['13055551213']})
47
+ if alert_preferences.present?
48
+ puts
49
+ puts 'alert preferences results:'
50
+ pp alert_preferences
51
+ else
52
+ puts
53
+ puts 'unable to get alert preferences'
54
+ error_messages.each { |m| puts m } if error_messages.present?
55
+ end
56
+ puts
57
+
58
+ rescue StandardError => error
59
+ rescue_standard_error(error)
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,46 @@
1
+ module FinApps
2
+ module REST
3
+
4
+ require 'erb'
5
+
6
+ class AlertPreferences < FinApps::REST::Resources
7
+ include FinApps::REST::Defaults
8
+
9
+ # @return [Hash, Array<String>]
10
+ def show
11
+ logger.debug "##{__method__.to_s} => Started"
12
+
13
+ end_point = Defaults::END_POINTS[:alert_preferences_show]
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_preferences_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
@@ -8,7 +8,7 @@ module FinApps
8
8
  attr_reader :connection, :users, :institutions, :user_institutions,
9
9
  :transactions, :categories,
10
10
  :budget_models, :budget_calculation, :budgets, :cashflows,
11
- :alert, :alert_definition, :alert_settings,
11
+ :alert, :alert_definition, :alert_settings, :alert_preferences,
12
12
  :rule_sets
13
13
 
14
14
  # @param [String] company_identifier
@@ -206,7 +206,7 @@ module FinApps
206
206
  @alert ||= FinApps::REST::Alert.new self
207
207
  @alert_definition ||= FinApps::REST::AlertDefinition.new self
208
208
  @alert_settings ||= FinApps::REST::AlertSettings.new self
209
-
209
+ @alert_preferences ||= FinApps::REST::AlertPreferences.new self
210
210
  @rule_sets ||= FinApps::REST::Relevance::Rulesets.new self
211
211
  end
212
212
 
@@ -71,8 +71,8 @@ module FinApps
71
71
  :alert_settings_show => 'alerts/settings',
72
72
  :alert_settings_update => 'alerts/settings',
73
73
 
74
- :alert_preference_list => 'alerts/preferences',
75
- :alert_preference_update => 'alerts/preferences'
74
+ :alert_preferences_show => 'alerts/preferences',
75
+ :alert_preferences_update => 'alerts/preferences'
76
76
 
77
77
 
78
78
  }.freeze
@@ -9,7 +9,6 @@ module FinApps
9
9
  # @return [FinApps::REST::Resources]
10
10
  def initialize(client)
11
11
  @client = client
12
- logger.debug "##{__method__.to_s} => #{self.class.name} initialized."
13
12
  end
14
13
 
15
14
  end
@@ -1,3 +1,3 @@
1
1
  module FinApps
2
- VERSION = '0.16.6.pre'
2
+ VERSION = '0.17.0.pre'
3
3
  end
data/lib/finapps.rb CHANGED
@@ -31,6 +31,7 @@ require 'finapps/rest/cashflows'
31
31
  require 'finapps/rest/alert'
32
32
  require 'finapps/rest/alert_definition'
33
33
  require 'finapps/rest/alert_settings'
34
+ require 'finapps/rest/alert_preferences'
34
35
 
35
36
  require 'finapps/rest/relevance/rulesets'
36
37
 
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.16.6.pre
4
+ version: 0.17.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-02-11 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -191,6 +191,7 @@ files:
191
191
  - bin/finapps
192
192
  - finapps.gemspec
193
193
  - lib/finapps.rb
194
+ - lib/finapps/cli/alert_preferences.rb
194
195
  - lib/finapps/cli/budgets.rb
195
196
  - lib/finapps/cli/cashflows.rb
196
197
  - lib/finapps/cli/common.rb
@@ -201,6 +202,7 @@ files:
201
202
  - lib/finapps/middleware/response_logger.rb
202
203
  - lib/finapps/rest/alert.rb
203
204
  - lib/finapps/rest/alert_definition.rb
205
+ - lib/finapps/rest/alert_preferences.rb
204
206
  - lib/finapps/rest/alert_settings.rb
205
207
  - lib/finapps/rest/budget_calculation.rb
206
208
  - lib/finapps/rest/budget_models.rb