finapps 0.22.4.pre → 1.0.0
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.
- checksums.yaml +4 -4
- data/.gitignore +7 -25
- data/.rspec +5 -0
- data/finapps.gemspec +8 -8
- data/lib/finapps/middleware/api_token.rb +6 -6
- data/lib/finapps/rest/alert.rb +12 -5
- data/lib/finapps/rest/alert_definition.rb +11 -3
- data/lib/finapps/rest/alert_preferences.rb +10 -2
- data/lib/finapps/rest/alert_settings.rb +11 -3
- data/lib/finapps/rest/budget_calculation.rb +11 -4
- data/lib/finapps/rest/budget_models.rb +11 -3
- data/lib/finapps/rest/budgets.rb +10 -4
- data/lib/finapps/rest/cashflows.rb +5 -3
- data/lib/finapps/rest/categories.rb +6 -2
- data/lib/finapps/rest/client.rb +102 -48
- data/lib/finapps/rest/connection.rb +20 -45
- data/lib/finapps/rest/defaults.rb +1 -2
- data/lib/finapps/rest/institutions.rb +11 -3
- data/lib/finapps/rest/relevance/rulesets.rb +10 -10
- data/lib/finapps/rest/transactions.rb +16 -4
- data/lib/finapps/rest/user_institutions.rb +35 -10
- data/lib/finapps/rest/users.rb +20 -24
- data/lib/finapps/utils/logging.rb +7 -7
- data/lib/finapps/version.rb +1 -1
- data/spec/middleware/api_token_spec.rb +32 -0
- data/spec/rest/client_spec.rb +91 -59
- data/spec/rest/connection_spec.rb +40 -0
- data/spec/spec_helper.rb +12 -60
- data/spec/utils/logging_spec.rb +4 -8
- metadata +70 -54
- data/bin/finapps +0 -9
- data/lib/finapps/cli/alert_preferences.rb +0 -65
- data/lib/finapps/cli/budgets.rb +0 -37
- data/lib/finapps/cli/cashflows.rb +0 -37
- data/lib/finapps/cli/common.rb +0 -43
- data/lib/finapps/cli/institutions.rb +0 -59
- data/lib/finapps/cli/users.rb +0 -87
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'base64'
|
2
|
+
|
3
|
+
RSpec.describe FinApps::REST::Connection do
|
4
|
+
|
5
|
+
let(:dummy_class) { Class.new { extend FinApps::REST::Connection } }
|
6
|
+
let(:valid_credentials) { {:company_identifier => 'id', :company_token => 'token'} }
|
7
|
+
let(:user_credentials) { {:user_identifier => 'user_id', :user_token => 'user_token'} }
|
8
|
+
|
9
|
+
it { expect(dummy_class).to respond_to(:set_up_connection) }
|
10
|
+
|
11
|
+
describe '#set_up_connection' do
|
12
|
+
|
13
|
+
context 'when using valid company credentials' do
|
14
|
+
subject(:set_up_connection) { dummy_class.set_up_connection(valid_credentials, {}) }
|
15
|
+
it { expect(set_up_connection).to be_an_instance_of(Faraday::Connection) }
|
16
|
+
it { expect(set_up_connection.headers).to include({'Accept' => FinApps::REST::Defaults::HEADERS[:accept]}) }
|
17
|
+
it { expect(set_up_connection.headers).to include({'User-Agent' => FinApps::REST::Defaults::HEADERS[:user_agent]}) }
|
18
|
+
context 'when NOT providing user credentials' do
|
19
|
+
it { expect(set_up_connection.builder.handlers).not_to include(Faraday::Request::BasicAuthentication) }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when using valid user credentials' do
|
24
|
+
subject(:set_up_connection) { dummy_class.set_up_connection(valid_credentials, user_credentials) }
|
25
|
+
let(:header) { Faraday::Request::BasicAuthentication.header(user_credentials[:user_identifier], user_credentials[:user_token]) }
|
26
|
+
|
27
|
+
it { expect(set_up_connection.builder.handlers).to include(Faraday::Request::BasicAuthentication) }
|
28
|
+
it 'sets a proper authorization header' do
|
29
|
+
stub_request(:get, "#{FinApps::REST::Defaults::DEFAULTS[:host]}/auth-echo").to_return(:status => 200)
|
30
|
+
expect(set_up_connection.get('/auth-echo').env.request_headers).to include({:authorization => header})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'using an invalid host_url parameter' do
|
35
|
+
subject(:set_up_connection) { dummy_class.set_up_connection(valid_credentials, {:host => 'yahoo.com'}) }
|
36
|
+
it { expect { set_up_connection }.to raise_error(FinApps::REST::InvalidArgumentsError) }
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,68 +19,20 @@ require 'finapps'
|
|
19
19
|
#
|
20
20
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
21
21
|
RSpec.configure do |config|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
config.expect_with(:rspec) do |expectations|
|
23
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
24
|
+
expectations.syntax = :expect
|
25
|
+
end
|
26
|
+
config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
|
27
27
|
config.filter_run :focus
|
28
28
|
config.run_all_when_everything_filtered = true
|
29
|
-
|
30
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
31
|
-
# file, and it's useful to allow more verbose output when running an
|
32
|
-
# individual spec file.
|
33
|
-
if config.files_to_run.one?
|
34
|
-
# Use the documentation formatter for detailed output,
|
35
|
-
# unless a formatter has already been configured
|
36
|
-
# (e.g. via a command-line flag).
|
37
|
-
config.default_formatter = 'doc'
|
38
|
-
end
|
39
|
-
|
40
|
-
# Run specs in random order to surface order dependencies. If you find an
|
41
|
-
# order dependency and want to debug it, you can fix the order by providing
|
42
|
-
# the seed, which is printed after each run.
|
43
|
-
# --seed 1234
|
29
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
44
30
|
config.order = :random
|
45
|
-
|
46
|
-
#
|
47
|
-
|
48
|
-
=
|
49
|
-
|
50
|
-
# Print the 10 slowest examples and example groups at the
|
51
|
-
# end of the spec run, to help surface which specs are running
|
52
|
-
# particularly slow.
|
53
|
-
config.profile_examples = 10
|
54
|
-
|
55
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
56
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
57
|
-
# test failures related to randomization by passing the same `--seed` value
|
58
|
-
# as the one that triggered the failure.
|
31
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
32
|
+
#config.disable_monkey_patching!
|
33
|
+
config.warnings = true
|
34
|
+
config.profile_examples = 5
|
59
35
|
Kernel.srand config.seed
|
60
|
-
|
61
|
-
# rspec-expectations config goes here. You can use an alternate
|
62
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
63
|
-
# assertions if you prefer.
|
64
|
-
config.expect_with :rspec do |expectations|
|
65
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
66
|
-
# For more details, see:
|
67
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
68
|
-
expectations.syntax = :expect
|
69
|
-
end
|
70
|
-
|
71
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
72
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
73
|
-
config.mock_with :rspec do |mocks|
|
74
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
75
|
-
# For more details, see:
|
76
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
-
mocks.syntax = :expect
|
78
|
-
|
79
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
80
|
-
# a real object. This is generally recommended.
|
81
|
-
mocks.verify_partial_doubles = true
|
82
|
-
end
|
83
|
-
=end
|
84
|
-
|
85
|
-
|
86
36
|
end
|
37
|
+
|
38
|
+
require 'webmock/rspec'
|
data/spec/utils/logging_spec.rb
CHANGED
@@ -6,7 +6,8 @@ RSpec.describe FinApps::Logging do
|
|
6
6
|
let(:simple_hash) { {:login => 'login', :password => 'secret'} }
|
7
7
|
let(:deep_hash) { {:parameters => {:login => 'login', :password => 'secret'}} }
|
8
8
|
let(:array_of_hashes) { {:parameters => [{:login => 'login', :password => 'secret'},
|
9
|
-
{:
|
9
|
+
{:login1 => 'login1', :password1 => 'secret1'},
|
10
|
+
{:user => 'user', :token => 'secret'}]} }
|
10
11
|
|
11
12
|
it 'should redact protected keys on a simple Hash' do
|
12
13
|
redacted = dummy_class.skip_sensitive_data simple_hash
|
@@ -21,12 +22,7 @@ RSpec.describe FinApps::Logging do
|
|
21
22
|
it 'should redact protected keys on an array of Hashes' do
|
22
23
|
redacted = dummy_class.skip_sensitive_data array_of_hashes
|
23
24
|
expect(redacted[:parameters][0][:password]).to eq('[REDACTED]')
|
24
|
-
expect(redacted[:parameters][1][:
|
25
|
+
expect(redacted[:parameters][1][:password1]).to eq('[REDACTED]')
|
26
|
+
expect(redacted[:parameters][2][:token]).to eq('[REDACTED]')
|
25
27
|
end
|
26
28
|
end
|
27
|
-
|
28
|
-
|
29
|
-
=begin
|
30
|
-
params : {:parameters => {"LOGIN1" => "MoneyMatch.site16441.1", "PASSWORD1" => "site16441.1"}}
|
31
|
-
params : {:email => "erich@example.com", :password => "[REDACTED]"}
|
32
|
-
=end
|
metadata
CHANGED
@@ -1,180 +1,199 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.9'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.9.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.9'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.9.2
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: faraday_middleware
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.10'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.10.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.10'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.10.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: typhoeus
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0
|
59
|
+
version: '1.0'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 1.0.1
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
69
|
+
version: '1.0'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
72
|
+
version: 1.0.1
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
74
|
+
name: rash
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '0.
|
79
|
+
version: '0.4'
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.4.0
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.4'
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 0.
|
92
|
+
version: 0.4.0
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: bundler
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '1.11'
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
103
|
-
type: :
|
102
|
+
version: 1.11.2
|
103
|
+
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '1.11'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 1.11.2
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
114
|
+
name: rake
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '1
|
119
|
+
version: '11.1'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 1.
|
122
|
+
version: 11.1.2
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '1
|
129
|
+
version: '11.1'
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 1.
|
132
|
+
version: 11.1.2
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
|
-
name:
|
134
|
+
name: fuubar
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0
|
139
|
+
version: '2.0'
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: 0.
|
142
|
+
version: 2.0.0
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - "~>"
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: '0
|
149
|
+
version: '2.0'
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 2.0.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rspec
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '3.
|
159
|
+
version: '3.4'
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: 3.
|
162
|
+
version: 3.4.0
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - "~>"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '3.
|
169
|
+
version: '3.4'
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 3.
|
172
|
+
version: 3.4.0
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: webmock
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '1.24'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 1.24.2
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '1.24'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 1.24.2
|
173
193
|
description: A simple library for communicating with the FinApps REST API.
|
174
194
|
email:
|
175
195
|
- erich@financialapps.com
|
176
|
-
executables:
|
177
|
-
- finapps
|
196
|
+
executables: []
|
178
197
|
extensions: []
|
179
198
|
extra_rdoc_files:
|
180
199
|
- README.md
|
@@ -188,15 +207,8 @@ files:
|
|
188
207
|
- LICENSE.txt
|
189
208
|
- README.md
|
190
209
|
- Rakefile
|
191
|
-
- bin/finapps
|
192
210
|
- finapps.gemspec
|
193
211
|
- lib/finapps.rb
|
194
|
-
- lib/finapps/cli/alert_preferences.rb
|
195
|
-
- lib/finapps/cli/budgets.rb
|
196
|
-
- lib/finapps/cli/cashflows.rb
|
197
|
-
- lib/finapps/cli/common.rb
|
198
|
-
- lib/finapps/cli/institutions.rb
|
199
|
-
- lib/finapps/cli/users.rb
|
200
212
|
- lib/finapps/middleware/api_token.rb
|
201
213
|
- lib/finapps/middleware/raise_http_exceptions.rb
|
202
214
|
- lib/finapps/middleware/response_logger.rb
|
@@ -223,7 +235,9 @@ files:
|
|
223
235
|
- lib/finapps/utils/logging.rb
|
224
236
|
- lib/finapps/utils/utils.rb
|
225
237
|
- lib/finapps/version.rb
|
238
|
+
- spec/middleware/api_token_spec.rb
|
226
239
|
- spec/rest/client_spec.rb
|
240
|
+
- spec/rest/connection_spec.rb
|
227
241
|
- spec/spec_helper.rb
|
228
242
|
- spec/utils/logging_spec.rb
|
229
243
|
homepage: http://github.com/finapps/finapps-ruby
|
@@ -247,16 +261,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
261
|
version: '0'
|
248
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
263
|
requirements:
|
250
|
-
- - "
|
264
|
+
- - ">="
|
251
265
|
- !ruby/object:Gem::Version
|
252
|
-
version:
|
266
|
+
version: '0'
|
253
267
|
requirements: []
|
254
268
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.6.
|
269
|
+
rubygems_version: 2.6.2
|
256
270
|
signing_key:
|
257
271
|
specification_version: 4
|
258
272
|
summary: FinApps REST API ruby client.
|
259
273
|
test_files:
|
260
274
|
- spec/spec_helper.rb
|
275
|
+
- spec/rest/connection_spec.rb
|
261
276
|
- spec/rest/client_spec.rb
|
262
277
|
- spec/utils/logging_spec.rb
|
278
|
+
- spec/middleware/api_token_spec.rb
|
data/bin/finapps
DELETED
@@ -1,65 +0,0 @@
|
|
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 => []})
|
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
|