finapps_core 5.0.5 → 5.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +9 -8
- data/.rubocop.yml +131 -74
- data/.tmuxinator.yml +20 -0
- data/.travis.yml +5 -6
- data/RELEASES.md +8 -0
- data/finapps_core.gemspec +10 -10
- data/lib/finapps_core.rb +1 -0
- data/lib/finapps_core/middleware/middleware.rb +7 -3
- data/lib/finapps_core/middleware/request/accept_json.rb +2 -1
- data/lib/finapps_core/middleware/request/user_agent.rb +1 -1
- data/lib/finapps_core/middleware/request/x_consumer_id.rb +20 -0
- data/lib/finapps_core/middleware/response/raise_error.rb +36 -7
- data/lib/finapps_core/rest/base_client.rb +18 -30
- data/lib/finapps_core/rest/configuration.rb +17 -4
- data/lib/finapps_core/rest/connection.rb +31 -21
- data/lib/finapps_core/rest/defaults.rb +1 -1
- data/lib/finapps_core/utils/validatable.rb +1 -1
- data/lib/finapps_core/version.rb +1 -1
- data/spec/core_extensions/object/is_integer_spec.rb +6 -7
- data/spec/middleware/request/accept_json_spec.rb +7 -3
- data/spec/middleware/request/no_encoding_basic_authentication_spec.rb +15 -6
- data/spec/middleware/request/request_id_spec.rb +4 -4
- data/spec/middleware/request/tenant_authentication_spec.rb +21 -14
- data/spec/middleware/request/user_agent_spec.rb +8 -3
- data/spec/middleware/request/x_consumer_id_spec.rb +16 -0
- data/spec/middleware/response/raise_error_spec.rb +47 -15
- data/spec/rest/base_client_spec.rb +87 -43
- data/spec/rest/configuration_spec.rb +25 -18
- data/spec/rest/credentials_spec.rb +4 -4
- data/spec/rest/defaults_spec.rb +1 -1
- data/spec/rest/resources_spec.rb +10 -20
- data/spec/spec_helper.rb +3 -3
- data/spec/utils/validatable_spec.rb +9 -8
- metadata +69 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7430c005b154f12216d5ea8075681c9ff616a783e1b4706c339531e1a821aa95
|
4
|
+
data.tar.gz: 0edaf97a7ab75208c30944d75243bab93471b249b99aeeed86a51f2025e3f6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769493f4d4bc686430d96dd960daf52383e2d8eea8a4b9ed7a36bcb9151d3ff201f8e8f0611947b71e970fc6f8e0cce822009c8c295f1ee418885c7c2ebf31e7
|
7
|
+
data.tar.gz: ef666e527b1e772180f0586ec5d7ba9250fed366c8e539e73735337a8e1f16238ecd270cd5547401e7c30fdfd59c7a6dad70433452eb769dab2d55473dff7198
|
data/.codeclimate.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
version: "2"
|
2
|
+
plugins:
|
2
3
|
rubocop:
|
3
4
|
enabled: true
|
5
|
+
channel: rubocop-0-74
|
4
6
|
brakeman:
|
5
7
|
enabled: false
|
6
8
|
eslint:
|
@@ -11,11 +13,10 @@ engines:
|
|
11
13
|
enabled: true
|
12
14
|
config:
|
13
15
|
languages:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- lib/**
|
18
|
-
- "**.rb"
|
19
|
-
exclude_paths:
|
16
|
+
ruby:
|
17
|
+
mass_threshold: 30
|
18
|
+
exclude_patterns:
|
20
19
|
- spec/**/*
|
21
|
-
- "**/vendor/**/*"
|
20
|
+
- "**/vendor/**/*"
|
21
|
+
- lib/finapps_core/rest/connection.rb
|
22
|
+
- lib/core_extensions/string/json_to_hash.rb
|
data/.rubocop.yml
CHANGED
@@ -1,24 +1,78 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-performance
|
4
|
+
|
1
5
|
AllCops:
|
2
|
-
|
6
|
+
TargetRubyVersion: 2.6
|
3
7
|
Exclude:
|
4
|
-
- "
|
5
|
-
|
6
|
-
|
7
|
-
# Commonly used screens these days easily fit more than 80 characters.
|
8
|
-
Metrics/LineLength:
|
9
|
-
Max: 120
|
10
|
-
|
11
|
-
# Re-enable this when the following is resolved:
|
12
|
-
# https://github.com/rubocop-hq/rubocop/issues/5953
|
13
|
-
Style/AccessModifierDeclarations:
|
14
|
-
Enabled: false
|
8
|
+
- "vendor/**/*"
|
9
|
+
- "bin/**/*"
|
10
|
+
CacheRootDirectory: tmp
|
15
11
|
|
12
|
+
Layout/SpaceAroundMethodCallOperator:
|
13
|
+
Enabled: true
|
14
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
15
|
+
Enabled: true
|
16
16
|
Layout/SpaceInsideBlockBraces:
|
17
17
|
# The space here provides no real gain in readability while consuming
|
18
18
|
# horizontal space that could be used for a better parameter name.
|
19
19
|
# Also {| differentiates better from a hash than { | does.
|
20
20
|
SpaceBeforeBlockParameters: false
|
21
|
+
Layout/SpaceInsideHashLiteralBraces:
|
22
|
+
EnforcedStyle: no_space
|
23
|
+
Layout/DotPosition:
|
24
|
+
Description: Checks the position of the dot in multi-line method calls.
|
25
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
26
|
+
Enabled: true
|
27
|
+
EnforcedStyle: leading
|
28
|
+
SupportedStyles:
|
29
|
+
- leading
|
30
|
+
- trailing
|
31
|
+
Layout/LineLength:
|
32
|
+
Max: 110
|
21
33
|
|
34
|
+
Lint/DeprecatedOpenSSLConstant:
|
35
|
+
Enabled: true
|
36
|
+
Lint/MixedRegexpCaptureTypes:
|
37
|
+
Enabled: true
|
38
|
+
Lint/RaiseException:
|
39
|
+
Enabled: true
|
40
|
+
Lint/StructNewOverride:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Metrics/ClassLength:
|
44
|
+
Exclude:
|
45
|
+
- app/controllers/orders_controller.rb
|
46
|
+
- app/models/order.rb
|
47
|
+
Metrics/BlockLength:
|
48
|
+
ExcludedMethods: ['describe', 'context']
|
49
|
+
Exclude:
|
50
|
+
- config/environments/**/**
|
51
|
+
- '*.gemspec'
|
52
|
+
- Guardfile
|
53
|
+
- config/routes.rb
|
54
|
+
- config/Guardfile
|
55
|
+
|
56
|
+
Naming/PredicateName:
|
57
|
+
Description: Check the names of predicate methods.
|
58
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
59
|
+
Enabled: true
|
60
|
+
NamePrefix:
|
61
|
+
- is_
|
62
|
+
- has_
|
63
|
+
- have_
|
64
|
+
ForbiddenPrefixes:
|
65
|
+
- is_
|
66
|
+
Exclude:
|
67
|
+
- spec/**/*
|
68
|
+
|
69
|
+
RSpec/FilePath:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Style/RedundantRegexpCharacterClass:
|
73
|
+
Enabled: true
|
74
|
+
Style/RedundantRegexpEscape:
|
75
|
+
Enabled: true
|
22
76
|
Style/CollectionMethods:
|
23
77
|
Description: Preferred collection methods.
|
24
78
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
|
@@ -29,73 +83,76 @@ Style/CollectionMethods:
|
|
29
83
|
find: detect
|
30
84
|
find_all: select
|
31
85
|
reduce: inject
|
86
|
+
Style/GuardClause:
|
87
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
88
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
89
|
+
Enabled: true
|
90
|
+
MinBodyLength: 1
|
32
91
|
Style/OptionHash:
|
33
92
|
Description: Don't use option hashes when you can use keyword arguments.
|
34
93
|
Enabled: false
|
35
|
-
|
36
|
-
Description:
|
37
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#
|
38
|
-
Enabled: true
|
39
|
-
NamePrefix:
|
40
|
-
- is_
|
41
|
-
- has_
|
42
|
-
- have_
|
43
|
-
NamePrefixBlacklist:
|
44
|
-
- is_
|
45
|
-
Exclude:
|
46
|
-
- spec/**/*
|
47
|
-
Metrics/AbcSize:
|
48
|
-
Description: A calculated magnitude based on number of assignments, branches, and
|
49
|
-
conditions.
|
94
|
+
Style/PercentLiteralDelimiters:
|
95
|
+
Description: Use `%`-literal delimiters consistently
|
96
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
|
50
97
|
Enabled: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
Description:
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
98
|
+
PreferredDelimiters:
|
99
|
+
"%": "()"
|
100
|
+
"%i": "()"
|
101
|
+
"%q": "()"
|
102
|
+
"%Q": "()"
|
103
|
+
"%r": "{}"
|
104
|
+
"%s": "()"
|
105
|
+
"%w": "()"
|
106
|
+
"%W": "()"
|
107
|
+
"%x": "()"
|
108
|
+
Style/SignalException:
|
109
|
+
Description: Checks for proper usage of fail and raise.
|
110
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
|
111
|
+
Enabled: true
|
112
|
+
EnforcedStyle: semantic
|
113
|
+
SupportedStyles:
|
114
|
+
- only_raise
|
115
|
+
- only_fail
|
116
|
+
- semantic
|
117
|
+
Style/StringLiterals:
|
118
|
+
Description: Checks if uses of quotes match the configured preference.
|
119
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
|
120
|
+
Enabled: true
|
121
|
+
EnforcedStyle: single_quotes
|
122
|
+
SupportedStyles:
|
123
|
+
- single_quotes
|
124
|
+
- double_quotes
|
125
|
+
Style/StringLiteralsInInterpolation:
|
126
|
+
Description: Checks if uses of quotes inside expressions in interpolated strings
|
127
|
+
match the configured preference.
|
128
|
+
Enabled: true
|
129
|
+
EnforcedStyle: single_quotes
|
130
|
+
SupportedStyles:
|
131
|
+
- single_quotes
|
132
|
+
- double_quotes
|
86
133
|
Style/Documentation:
|
87
134
|
Description: Document classes and non-namespace modules.
|
88
135
|
Enabled: false
|
89
|
-
Style/
|
90
|
-
Description:
|
91
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#
|
136
|
+
Style/OneLineConditional:
|
137
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
138
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
92
139
|
Enabled: false
|
93
|
-
Style/
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
140
|
+
Style/ExponentialNotation:
|
141
|
+
Enabled: true
|
142
|
+
Style/HashEachMethods:
|
143
|
+
Enabled: true
|
144
|
+
Style/HashTransformKeys:
|
145
|
+
Enabled: true
|
146
|
+
Style/HashTransformValues:
|
147
|
+
Enabled: true
|
148
|
+
Style/RedundantFetchBlock:
|
149
|
+
Enabled: true
|
150
|
+
Style/SlicingWithRange:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
RSpec/NestedGroups:
|
154
|
+
Max: 5
|
155
|
+
RSpec/DescribeClass:
|
156
|
+
Exclude:
|
157
|
+
- spec/system/*
|
158
|
+
- spec/factories_spec.rb
|
data/.tmuxinator.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: ruby-client-core
|
3
|
+
root: ~/projects/ruby-client-core/
|
4
|
+
windows:
|
5
|
+
-
|
6
|
+
editor:
|
7
|
+
layout: main-vertical
|
8
|
+
panes:
|
9
|
+
- vim: $EDITOR
|
10
|
+
- bash:
|
11
|
+
- git pull
|
12
|
+
- git status
|
13
|
+
- bundle
|
14
|
+
- bundle outdated
|
15
|
+
-
|
16
|
+
guard:
|
17
|
+
layout: even-horizontal
|
18
|
+
panes:
|
19
|
+
- guard:
|
20
|
+
- bundle exec guard
|
data/.travis.yml
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
2
|
+
os: ["linux"]
|
3
|
+
dist: "xenial"
|
4
|
+
|
3
5
|
cache:
|
4
6
|
bundler: true
|
5
7
|
|
6
8
|
rvm:
|
7
|
-
- 2.5
|
8
9
|
- 2.6
|
9
|
-
- ruby-head
|
10
10
|
|
11
11
|
before_install:
|
12
12
|
- "echo 'gem: --no-document' > ~/.gemrc"
|
13
|
-
- gem
|
14
|
-
- gem install bundler -v "~>2.0"
|
13
|
+
- gem install bundler --force --quiet
|
15
14
|
|
16
15
|
script:
|
17
16
|
- bundle exec rspec
|
@@ -23,4 +22,4 @@ addons:
|
|
23
22
|
code_climate:
|
24
23
|
repo_token: 5a8d194cbc23aa4c171e3478e3b6bbea9dd96041071380ec25bf80c07770b39a
|
25
24
|
after_success:
|
26
|
-
- bundle exec codeclimate-test-reporter
|
25
|
+
- bundle exec codeclimate-test-reporter
|
data/RELEASES.md
ADDED
data/finapps_core.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
|
-
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'finapps_core/version'
|
6
6
|
Gem::Specification.new do |spec|
|
@@ -20,20 +20,20 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = Dir['spec/**/*.rb']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'faraday', '~> 0
|
24
|
-
spec.add_runtime_dependency 'faraday_middleware', '~> 0
|
23
|
+
spec.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.1'
|
24
|
+
spec.add_runtime_dependency 'faraday_middleware', '~> 1.0', '>= 1.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~> 2.0',
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
27
27
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.9'
|
28
28
|
spec.add_development_dependency 'gem-release', '~> 2.0', '>= 2.0.3'
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
29
|
+
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.8', '>= 3.8.0'
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
32
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
33
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.86', '>= 0.86.0'
|
32
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.6', '>= 1.6.1'
|
33
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.40', '>= 1.40.0'
|
34
34
|
spec.add_development_dependency 'sinatra', '~> 2.0', '>= 2.0.5'
|
35
35
|
spec.add_development_dependency 'webmock', '~> 3.6', '>= 3.6.0'
|
36
36
|
|
37
37
|
spec.extra_rdoc_files = %w(README.md LICENSE)
|
38
38
|
spec.rdoc_options = %w(--line-numbers --inline-source --title finapps-ruby-core --main README.md)
|
39
|
-
end
|
39
|
+
end
|
data/lib/finapps_core.rb
CHANGED
@@ -17,6 +17,7 @@ require 'finapps_core/middleware/request/no_encoding_basic_authentication'
|
|
17
17
|
require 'finapps_core/middleware/request/accept_json'
|
18
18
|
require 'finapps_core/middleware/request/user_agent'
|
19
19
|
require 'finapps_core/middleware/request/request_id'
|
20
|
+
require 'finapps_core/middleware/request/x_consumer_id'
|
20
21
|
require 'finapps_core/middleware/response/raise_error'
|
21
22
|
require 'finapps_core/middleware/middleware'
|
22
23
|
|
@@ -6,9 +6,12 @@ module FinAppsCore
|
|
6
6
|
module Middleware
|
7
7
|
autoload :AcceptJson, 'finapps_core/middleware/request/accept_json'
|
8
8
|
autoload :UserAgent, 'finapps_core/middleware/request/user_agent'
|
9
|
-
autoload :NoEncodingBasicAuthentication,
|
10
|
-
|
9
|
+
autoload :NoEncodingBasicAuthentication,
|
10
|
+
'finapps_core/middleware/request/no_encoding_basic_authentication'
|
11
|
+
autoload :TenantAuthentication,
|
12
|
+
'finapps_core/middleware/request/tenant_authentication'
|
11
13
|
autoload :RequestId, 'finapps_core/middleware/request/request_id'
|
14
|
+
autoload :XConsumerId, 'finapps_core/middleware/request/x_consumer_id'
|
12
15
|
|
13
16
|
if Faraday::Middleware.respond_to? :register_middleware
|
14
17
|
Faraday::Request.register_middleware \
|
@@ -16,7 +19,8 @@ module FinAppsCore
|
|
16
19
|
user_agent: -> { UserAgent },
|
17
20
|
no_encoding_basic_authentication: -> { NoEncodingBasicAuthentication },
|
18
21
|
tenant_authentication: -> { TenantAuthentication },
|
19
|
-
request_id: -> { RequestId }
|
22
|
+
request_id: -> { RequestId },
|
23
|
+
x_consumer_id: -> { XConsumerId }
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module FinAppsCore
|
4
4
|
module Middleware
|
5
|
-
# This middleware sets the Accept request-header field to specify JSON
|
5
|
+
# This middleware sets the Accept request-header field to specify JSON
|
6
|
+
# as acceptable media type for the response.
|
6
7
|
class AcceptJson < Faraday::Middleware
|
7
8
|
KEY = 'Accept' unless defined? KEY
|
8
9
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module FinAppsCore
|
4
4
|
module Middleware
|
5
|
-
# This middleware sets the User-Agent request-header field to identify
|
5
|
+
# This middleware sets the User-Agent request-header field to identify the client.
|
6
6
|
class UserAgent < Faraday::Middleware
|
7
7
|
KEY = 'User-Agent' unless defined? KEY
|
8
8
|
RUBY = "#{RUBY_ENGINE}/#{RUBY_PLATFORM} #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FinAppsCore
|
4
|
+
module Middleware
|
5
|
+
# Adds a header to specify consumer to retrieve data for
|
6
|
+
class XConsumerId < Faraday::Middleware
|
7
|
+
KEY = 'X-Consumer-ID' unless defined? KEY
|
8
|
+
|
9
|
+
def initialize(app, x_consumer_id)
|
10
|
+
super(app)
|
11
|
+
@x_consumer_id = x_consumer_id.to_s.strip
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
env[:request_headers][KEY] ||= @x_consumer_id
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -16,12 +16,7 @@ module FinAppsCore
|
|
16
16
|
def on_complete(env)
|
17
17
|
return if SUCCESS_STATUSES.include?(env[:status])
|
18
18
|
|
19
|
-
|
20
|
-
raise(FinAppsCore::ApiSessionTimeoutError, 'API Session Timed out') if env[:status] == API_SESSION_TIMEOUT
|
21
|
-
raise(FinAppsCore::ConnectionFailedError, 'Connection Failed') if env[:status] == CONNECTION_FAILED_STATUS
|
22
|
-
raise(FinAppsCore::UserLockoutError, 'User is Locked') if user_is_locked?(env)
|
23
|
-
|
24
|
-
raise(Faraday::Error::ClientError, response_values(env))
|
19
|
+
failures env
|
25
20
|
end
|
26
21
|
|
27
22
|
def response_values(env)
|
@@ -35,6 +30,39 @@ module FinAppsCore
|
|
35
30
|
|
36
31
|
private
|
37
32
|
|
33
|
+
def failures(env)
|
34
|
+
api_authentication_fail env
|
35
|
+
api_session_timeout_fail env
|
36
|
+
locked_user_fail env
|
37
|
+
connection_fail env
|
38
|
+
|
39
|
+
fail(Faraday::ClientError, response_values(env))
|
40
|
+
end
|
41
|
+
|
42
|
+
def locked_user_fail(env)
|
43
|
+
return unless user_is_locked?(env)
|
44
|
+
|
45
|
+
fail(FinAppsCore::UserLockoutError, 'User is Locked')
|
46
|
+
end
|
47
|
+
|
48
|
+
def api_session_timeout_fail(env)
|
49
|
+
return unless env[:status] == API_SESSION_TIMEOUT
|
50
|
+
|
51
|
+
fail(FinAppsCore::ApiSessionTimeoutError, 'API Session Timed out')
|
52
|
+
end
|
53
|
+
|
54
|
+
def connection_fail(env)
|
55
|
+
return unless env[:status] == CONNECTION_FAILED_STATUS
|
56
|
+
|
57
|
+
fail(FinAppsCore::ConnectionFailedError, 'Connection Failed')
|
58
|
+
end
|
59
|
+
|
60
|
+
def api_authentication_fail(env)
|
61
|
+
return unless env[:status] == API_UNAUTHENTICATED
|
62
|
+
|
63
|
+
fail(FinAppsCore::ApiUnauthenticatedError, 'API Invalid Session')
|
64
|
+
end
|
65
|
+
|
38
66
|
def error_messages(body)
|
39
67
|
return nil if empty?(body)
|
40
68
|
|
@@ -59,7 +87,8 @@ module FinAppsCore
|
|
59
87
|
end
|
60
88
|
|
61
89
|
def user_is_locked?(env)
|
62
|
-
env.status == FORBIDDEN &&
|
90
|
+
env.status == FORBIDDEN &&
|
91
|
+
error_messages(env.body)&.[](0)&.downcase == LOCKOUT_MESSAGE
|
63
92
|
end
|
64
93
|
|
65
94
|
def symbolize(obj)
|