finapps 2.1.4 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -18
- data/.ruby-gemset +1 -1
- data/.travis.yml +5 -2
- data/README.md +1 -1
- data/finapps.gemspec +10 -12
- data/lib/finapps.rb +5 -21
- data/lib/finapps/rest/client.rb +42 -53
- data/lib/finapps/rest/institutions.rb +2 -2
- data/lib/finapps/rest/institutions_forms.rb +2 -2
- data/lib/finapps/rest/order_reports.rb +4 -4
- data/lib/finapps/rest/order_statuses.rb +2 -2
- data/lib/finapps/rest/order_tokens.rb +2 -3
- data/lib/finapps/rest/orders.rb +6 -6
- data/lib/finapps/rest/password_resets.rb +4 -4
- data/lib/finapps/rest/sessions.rb +2 -2
- data/lib/finapps/rest/user_institutions.rb +21 -26
- data/lib/finapps/rest/user_institutions_forms.rb +2 -2
- data/lib/finapps/rest/user_institutions_statuses.rb +2 -2
- data/lib/finapps/rest/users.rb +5 -5
- data/lib/finapps/rest/version.rb +1 -1
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +4 -13
- data/spec/rest/institutions_forms_spec.rb +5 -2
- data/spec/rest/institutions_spec.rb +4 -2
- data/spec/rest/order_reports_spec.rb +4 -4
- data/spec/rest/order_statuses_spec.rb +3 -2
- data/spec/rest/order_tokens_spec.rb +3 -2
- data/spec/rest/orders_spec.rb +6 -5
- data/spec/rest/password_resets_spec.rb +4 -4
- data/spec/rest/sessions_spec.rb +2 -2
- data/spec/rest/user_institutions_forms_spec.rb +5 -2
- data/spec/rest/user_institutions_spec.rb +10 -9
- data/spec/rest/user_institutions_statuses_spec.rb +3 -2
- data/spec/rest/users_spec.rb +4 -4
- data/spec/rest/version_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -3
- data/spec/spec_helpers/client.rb +1 -1
- metadata +49 -124
- data/lib/core_extensions/hash/compact.rb +0 -23
- data/lib/core_extensions/object/blank.rb +0 -69
- data/lib/core_extensions/object/is_integer.rb +0 -10
- data/lib/core_extensions/string/json_to_hash.rb +0 -10
- data/lib/finapps/error.rb +0 -17
- data/lib/finapps/middleware/middleware.rb +0 -22
- data/lib/finapps/middleware/request/accept_json.rb +0 -14
- data/lib/finapps/middleware/request/no_encoding_basic_authentication.rb +0 -21
- data/lib/finapps/middleware/request/tenant_authentication.rb +0 -20
- data/lib/finapps/middleware/request/user_agent.rb +0 -15
- data/lib/finapps/middleware/response/custom_logger.rb +0 -41
- data/lib/finapps/middleware/response/raise_error.rb +0 -46
- data/lib/finapps/rest/base_client.rb +0 -122
- data/lib/finapps/rest/configuration.rb +0 -31
- data/lib/finapps/rest/connection.rb +0 -35
- data/lib/finapps/rest/credentials.rb +0 -21
- data/lib/finapps/rest/defaults.rb +0 -80
- data/lib/finapps/rest/resources.rb +0 -64
- data/lib/finapps/utils/loggeable.rb +0 -14
- data/lib/finapps/utils/parameter_filter.rb +0 -32
- data/spec/core_extensions/hash/compact_spec.rb +0 -21
- data/spec/core_extensions/object/is_integer_spec.rb +0 -17
- data/spec/middleware/request/accept_json_spec.rb +0 -12
- data/spec/middleware/request/no_encoding_basic_authentication_spec.rb +0 -32
- data/spec/middleware/request/tenant_authentication_spec.rb +0 -34
- data/spec/middleware/request/user_agent_spec.rb +0 -12
- data/spec/middleware/response/raise_error_spec.rb +0 -24
- data/spec/rest/base_client_spec.rb +0 -120
- data/spec/rest/configuration_spec.rb +0 -39
- data/spec/rest/credentials_spec.rb +0 -20
- data/spec/rest/resources_spec.rb +0 -76
- data/spec/rest/timeout_spec.rb +0 -9
- data/spec/support/fixtures/relevance_ruleset_names.json +0 -47
- data/spec/utils/parameter_filter_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e24643441ce8ebb9cb808fe45de0df630e62ef0
|
4
|
+
data.tar.gz: 88348f3841bc6186ce306ed7a7c9ca4bc72a57d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e398a685f93991829879dd9146023a31713ae60fd12f928432b0d8a9cf0ba256120bc238d15bfe5227891bd9da7d029c04def2d017824c31d243edc329bd73f4
|
7
|
+
data.tar.gz: 649742621d86978e10804929252dd7aa297d2d8be8860620482e0a03adbd5ecef2e2afdc41600f1ef73600b12b1cf078aa439d6e4c55dddae6184b20a36cfe67
|
data/.rubocop.yml
CHANGED
@@ -142,29 +142,13 @@ Style/StringLiteralsInInterpolation:
|
|
142
142
|
SupportedStyles:
|
143
143
|
- single_quotes
|
144
144
|
- double_quotes
|
145
|
-
Style/TrailingCommaInArguments:
|
146
|
-
Description: 'Checks for trailing comma in argument lists.'
|
147
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
148
|
-
Enabled: false
|
149
|
-
EnforcedStyleForMultiline: no_comma
|
150
|
-
SupportedStyles:
|
151
|
-
- comma
|
152
|
-
- consistent_comma
|
153
|
-
- no_comma
|
154
|
-
Style/TrailingCommaInLiteral:
|
155
|
-
Description: 'Checks for trailing comma in array and hash literals.'
|
156
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
157
|
-
Enabled: false
|
158
|
-
EnforcedStyleForMultiline: no_comma
|
159
|
-
SupportedStyles:
|
160
|
-
- comma
|
161
|
-
- consistent_comma
|
162
|
-
- no_comma
|
163
145
|
Metrics/AbcSize:
|
164
146
|
Description: A calculated magnitude based on number of assignments, branches, and
|
165
147
|
conditions.
|
166
148
|
Enabled: false
|
167
149
|
Max: 15
|
150
|
+
Metrics/BlockLength:
|
151
|
+
ExcludedMethods: ['describe', 'context']
|
168
152
|
Metrics/ClassLength:
|
169
153
|
Description: Avoid classes longer than 100 lines of code.
|
170
154
|
Enabled: false
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-client
|
1
|
+
ruby-client
|
data/.travis.yml
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.3.0
|
5
4
|
- 2.3.1
|
6
5
|
before_install:
|
7
|
-
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
6
|
+
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
|
7
|
+
- gem update --system
|
8
|
+
- gem install bundler
|
8
9
|
script:
|
9
10
|
- bundle exec rspec
|
10
11
|
notifications:
|
@@ -13,3 +14,5 @@ notifications:
|
|
13
14
|
addons:
|
14
15
|
code_climate:
|
15
16
|
repo_token: dc180b31d340bd88cedd0ec3ea8ba8ec5093f2bafe77a7bf5bbdcb1c5ff9dc7f
|
17
|
+
after_success:
|
18
|
+
- bundle exec codeclimate-test-reporter
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ FinApps Ruby-Client
|
|
3
3
|
===================
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/finapps.svg)](https://badge.fury.io/rb/finapps)
|
6
|
-
[![Build Status](
|
6
|
+
[![Build Status](https://travis-ci.org/finapps/ruby-client.svg?branch=master)](https://travis-ci.org/finapps/ruby-client)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/finapps/ruby-client/badges/gpa.svg)](https://codeclimate.com/github/finapps/ruby-client)
|
8
8
|
[![Test Coverage](https://codeclimate.com/github/finapps/ruby-client/badges/coverage.svg)](https://codeclimate.com/github/finapps/ruby-client/coverage)
|
9
9
|
[![Dependency Status](https://gemnasium.com/badges/github.com/finapps/ruby-client.svg)](https://gemnasium.com/github.com/finapps/ruby-client)
|
data/finapps.gemspec
CHANGED
@@ -20,19 +20,17 @@ 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
|
24
|
-
spec.add_runtime_dependency 'faraday_middleware', '~> 0.10', '>= 0.10.0'
|
25
|
-
spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.2'
|
26
|
-
spec.add_runtime_dependency 'rash', '~> 0.4', '>= 0.4.0'
|
23
|
+
spec.add_runtime_dependency 'finapps_core', '~> 2.0', '>= 2.0.11'
|
27
24
|
|
28
|
-
spec.add_development_dependency 'bundler',
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency '
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency '
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.14', '>= 1.14.3'
|
26
|
+
spec.add_development_dependency 'gem-release', '~> 0.7', '>= 0.7.4'
|
27
|
+
spec.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
|
29
|
+
spec.add_development_dependency 'webmock', '~> 2.3', '>= 2.3.2'
|
30
|
+
spec.add_development_dependency 'sinatra', '~> 1.4', '>= 1.4.7'
|
31
|
+
spec.add_development_dependency 'simplecov', '~> 0.11', '>= 0.11.2'
|
32
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.5'
|
33
|
+
spec.add_development_dependency 'rubocop', '~> 0.47', '>= 0.47.1'
|
36
34
|
|
37
35
|
spec.extra_rdoc_files = %w(README.md LICENSE.txt)
|
38
36
|
spec.rdoc_options = %w(--line-numbers --inline-source --title finapps-ruby --main README.md)
|
data/lib/finapps.rb
CHANGED
@@ -6,23 +6,7 @@ require 'faraday_middleware'
|
|
6
6
|
require 'typhoeus'
|
7
7
|
require 'typhoeus/adapters/faraday'
|
8
8
|
|
9
|
-
require '
|
10
|
-
require 'core_extensions/object/blank'
|
11
|
-
require 'core_extensions/object/is_integer'
|
12
|
-
require 'core_extensions/string/json_to_hash'
|
13
|
-
|
14
|
-
require 'finapps/utils/loggeable'
|
15
|
-
require 'finapps/utils/parameter_filter'
|
16
|
-
require 'finapps/error'
|
17
|
-
|
18
|
-
require 'finapps/middleware/request/tenant_authentication'
|
19
|
-
require 'finapps/middleware/request/accept_json'
|
20
|
-
require 'finapps/middleware/request/user_agent'
|
21
|
-
require 'finapps/middleware/response/raise_error'
|
22
|
-
require 'finapps/middleware/middleware'
|
23
|
-
|
24
|
-
require 'finapps/rest/defaults'
|
25
|
-
require 'finapps/rest/resources'
|
9
|
+
require 'finapps_core'
|
26
10
|
|
27
11
|
require 'finapps/rest/version'
|
28
12
|
require 'finapps/rest/users'
|
@@ -38,8 +22,8 @@ require 'finapps/rest/order_reports'
|
|
38
22
|
require 'finapps/rest/order_statuses'
|
39
23
|
require 'finapps/rest/password_resets'
|
40
24
|
|
41
|
-
require 'finapps/rest/configuration'
|
42
|
-
require 'finapps/rest/credentials'
|
43
|
-
require 'finapps/rest/connection'
|
44
|
-
require 'finapps/rest/base_client'
|
25
|
+
# require 'finapps/rest/configuration'
|
26
|
+
# require 'finapps/rest/credentials'
|
27
|
+
# require 'finapps/rest/connection'
|
28
|
+
# require 'finapps/rest/base_client'
|
45
29
|
require 'finapps/rest/client'
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -1,75 +1,64 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'finapps_core'
|
3
|
+
require_relative './version'
|
4
|
+
|
2
5
|
module FinApps
|
3
6
|
module REST
|
4
|
-
class Client < BaseClient # :nodoc:
|
7
|
+
class Client < FinAppsCore::REST::BaseClient # :nodoc:
|
5
8
|
using ObjectExtensions
|
6
9
|
using StringExtensions
|
7
10
|
|
8
|
-
|
11
|
+
RESOURCES = %i(
|
12
|
+
institutions
|
13
|
+
institutions_forms
|
14
|
+
orders
|
15
|
+
order_reports
|
16
|
+
order_statuses
|
17
|
+
order_tokens
|
18
|
+
password_resets
|
19
|
+
sessions
|
20
|
+
users
|
21
|
+
user_institutions
|
22
|
+
user_institutions_forms
|
23
|
+
user_institutions_statuses
|
24
|
+
version
|
25
|
+
).freeze
|
9
26
|
|
10
|
-
# @param [String] tenant_identifier
|
11
27
|
# @param [String] tenant_token
|
12
28
|
# @param [Hash] options
|
13
29
|
# @return [FinApps::REST::Client]
|
14
|
-
def initialize(
|
15
|
-
|
16
|
-
raise FinApps::MissingArgumentsError.new 'Invalid company_token.' if tenant_token.blank?
|
30
|
+
def initialize(tenant_token, options={}, logger=nil)
|
31
|
+
not_blank(tenant_token, :tenant_token)
|
17
32
|
|
18
|
-
merged_options =
|
19
|
-
tenant_token: tenant_token))
|
33
|
+
merged_options = options.merge(tenant_token: tenant_token)
|
20
34
|
super(merged_options, logger)
|
21
35
|
end
|
22
36
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
def order_tokens
|
36
|
-
@order_tokens ||= FinApps::REST::OrderTokens.new self
|
37
|
-
end
|
38
|
-
|
39
|
-
def orders
|
40
|
-
@orders ||= FinApps::REST::Orders.new self
|
41
|
-
end
|
42
|
-
|
43
|
-
def order_reports
|
44
|
-
@order_reports ||= FinApps::REST::OrderReports.new self
|
45
|
-
end
|
46
|
-
|
47
|
-
def order_statuses
|
48
|
-
@order_statuses ||= FinApps::REST::OrderStatuses.new self
|
49
|
-
end
|
50
|
-
|
51
|
-
def institutions
|
52
|
-
@institutions ||= FinApps::REST::Institutions.new self
|
37
|
+
def method_missing(symbol, *arguments, &block)
|
38
|
+
if RESOURCES.include? symbol
|
39
|
+
class_name = camelize(symbol.to_s)
|
40
|
+
variable = "@#{class_name.downcase}"
|
41
|
+
unless instance_variable_defined? variable
|
42
|
+
klass = Object.const_get('FinApps').const_get('REST').const_get class_name
|
43
|
+
instance_variable_set(variable, klass.new(self))
|
44
|
+
end
|
45
|
+
instance_variable_get(variable)
|
46
|
+
else
|
47
|
+
super
|
48
|
+
end
|
53
49
|
end
|
54
50
|
|
55
|
-
def
|
56
|
-
|
51
|
+
def respond_to_missing?(method_sym, include_private=false)
|
52
|
+
RESOURCES.include?(method_sym) ? true : super
|
57
53
|
end
|
58
54
|
|
59
|
-
|
60
|
-
@user_institutions_statuses ||= FinApps::REST::UserInstitutionsStatuses.new self
|
61
|
-
end
|
62
|
-
|
63
|
-
def user_institutions
|
64
|
-
@user_institutions ||= FinApps::REST::UserInstitutions.new self
|
65
|
-
end
|
66
|
-
|
67
|
-
def user_institutions_forms
|
68
|
-
@user_institutions_forms ||= FinApps::REST::UserInstitutionsForms.new self
|
69
|
-
end
|
55
|
+
private
|
70
56
|
|
71
|
-
def
|
72
|
-
|
57
|
+
def camelize(term)
|
58
|
+
string = term.to_s
|
59
|
+
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
60
|
+
string.gsub!(%r{(?:_|(/))([a-z\d]*)}) { $2.capitalize.to_s }
|
61
|
+
string
|
73
62
|
end
|
74
63
|
end
|
75
64
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class Institutions <
|
4
|
+
class Institutions < FinAppsCore::REST::Resources
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def list(search_term)
|
9
|
-
|
9
|
+
not_blank(search_term, :search_term)
|
10
10
|
# API errors when search_term is blank, maybe it shouldn't
|
11
11
|
|
12
12
|
path = "#{end_point}/search/#{ERB::Util.url_encode(search_term)}"
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class InstitutionsForms <
|
4
|
+
class InstitutionsForms < FinAppsCore::REST::Resources
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def show(site_id)
|
9
|
-
|
9
|
+
not_blank(site_id, :site_id)
|
10
10
|
|
11
11
|
path = "institutions/site/#{ERB::Util.url_encode(site_id)}/form"
|
12
12
|
super site_id, path
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class OrderReports <
|
4
|
+
class OrderReports < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def show(id, format)
|
9
|
-
|
10
|
-
|
11
|
-
raise InvalidArgumentsError.new 'Invalid argument: format' unless accepted_format?(format)
|
9
|
+
not_blank(id, :id)
|
10
|
+
not_blank(format, :format)
|
11
|
+
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: format' unless accepted_format?(format)
|
12
12
|
|
13
13
|
path = "orders/#{ERB::Util.url_encode(id)}/report.#{ERB::Util.url_encode(format)}"
|
14
14
|
super nil, path
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class OrderStatuses <
|
4
|
+
class OrderStatuses < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def show(id)
|
9
|
-
|
9
|
+
not_blank(id, :id)
|
10
10
|
|
11
11
|
path = "orders/#{ERB::Util.url_encode(id)}/status"
|
12
12
|
super nil, path
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class OrderTokens <
|
4
|
+
class OrderTokens < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def show(token)
|
9
|
-
|
10
|
-
|
9
|
+
not_blank(token, :token)
|
11
10
|
create nil, "orders/#{ERB::Util.url_encode(token)}"
|
12
11
|
end
|
13
12
|
end
|
data/lib/finapps/rest/orders.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class Orders <
|
4
|
+
class Orders < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def show(id)
|
9
|
-
|
9
|
+
not_blank(id, :id)
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
13
|
def create(params)
|
14
|
-
|
14
|
+
not_blank(params, :params)
|
15
15
|
super params
|
16
16
|
end
|
17
17
|
|
@@ -25,14 +25,14 @@ module FinApps
|
|
25
25
|
# :asc - sort order true for asc false for desc
|
26
26
|
def list(params=nil) # params hash with optional keys [:page, :requested, :sort, :asc]
|
27
27
|
return super 'list/orders/1/10000/date/false' if params.nil?
|
28
|
-
raise InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
|
28
|
+
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
|
29
29
|
|
30
30
|
super build_path(params)
|
31
31
|
end
|
32
32
|
|
33
33
|
def update(id, params)
|
34
|
-
|
35
|
-
|
34
|
+
not_blank(id, :id)
|
35
|
+
not_blank(params, :params)
|
36
36
|
# Params array need matching Institution ids & Account ids
|
37
37
|
# Validations to check each Institution id has at least one account id
|
38
38
|
# Validations to check at least 1 Institution id or 1 account "params.length >= 1"
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class PasswordResets <
|
4
|
+
class PasswordResets < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
def create(id)
|
9
|
-
|
9
|
+
not_blank(id, :id)
|
10
10
|
|
11
11
|
path = "tenant/#{ERB::Util.url_encode(id)}/password"
|
12
12
|
super nil, path
|
13
13
|
end
|
14
14
|
|
15
15
|
def update(id, params)
|
16
|
-
raise MissingArgumentsError.new 'Missing argument: id.' if id.blank?
|
17
|
-
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
16
|
+
raise FinAppsCore::MissingArgumentsError.new 'Missing argument: id.' if id.blank?
|
17
|
+
raise FinAppsCore::MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
18
18
|
|
19
19
|
path = "tenant/#{ERB::Util.url_encode(id)}/password"
|
20
20
|
super params, path
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class Sessions <
|
4
|
+
class Sessions < FinAppsCore::REST::Resources # :nodoc:
|
5
5
|
using ObjectExtensions
|
6
6
|
using StringExtensions
|
7
7
|
|
8
8
|
# @param [Hash] params
|
9
9
|
# @return [Array<String>]
|
10
10
|
def create(params)
|
11
|
-
raise InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
|
11
|
+
raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params.' unless validates params
|
12
12
|
|
13
13
|
super params, 'login'
|
14
14
|
end
|
@@ -1,20 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module FinApps
|
3
3
|
module REST
|
4
|
-
class UserInstitutions <
|
5
|
-
END_POINT = 'institutions/user'
|
6
|
-
|
4
|
+
class UserInstitutions < FinAppsCore::REST::Resources # :nodoc:
|
7
5
|
using ObjectExtensions
|
8
6
|
using StringExtensions
|
9
7
|
|
10
8
|
def list
|
11
|
-
|
12
|
-
super path
|
9
|
+
super END_POINT
|
13
10
|
end
|
14
11
|
|
15
12
|
def create(site_id, params)
|
16
|
-
|
17
|
-
|
13
|
+
not_blank(site_id, :site_id)
|
14
|
+
not_blank(params, :params)
|
18
15
|
|
19
16
|
path = "institutions/site/#{ERB::Util.url_encode(site_id)}/add"
|
20
17
|
|
@@ -22,40 +19,38 @@ module FinApps
|
|
22
19
|
end
|
23
20
|
|
24
21
|
def show(id)
|
25
|
-
|
26
|
-
|
27
|
-
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
|
28
|
-
super id, path
|
22
|
+
not_blank(id, :id)
|
23
|
+
super(id, user_institutions_path(id))
|
29
24
|
end
|
30
25
|
|
31
26
|
def credentials_update(id, params)
|
32
|
-
|
33
|
-
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
34
|
-
|
35
|
-
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/credentials"
|
36
|
-
update params, path
|
27
|
+
update id, params, 'credentials'
|
37
28
|
end
|
38
29
|
|
39
30
|
def mfa_update(id, params)
|
40
|
-
|
41
|
-
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
42
|
-
|
43
|
-
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}/mfa"
|
44
|
-
update params, path
|
31
|
+
update id, params, 'mfa'
|
45
32
|
end
|
46
33
|
|
47
34
|
def destroy(id)
|
48
|
-
|
49
|
-
|
50
|
-
path = "#{END_POINT}/#{ERB::Util.url_encode(id)}"
|
51
|
-
super id, path
|
35
|
+
not_blank(id, :id)
|
36
|
+
super(id, user_institutions_path(id))
|
52
37
|
end
|
53
38
|
|
54
39
|
private
|
55
40
|
|
56
|
-
|
41
|
+
END_POINT = 'institutions/user'
|
42
|
+
|
43
|
+
def update(id, params, method)
|
44
|
+
not_blank(id, :id)
|
45
|
+
not_blank(params, :params)
|
46
|
+
|
47
|
+
path = "#{user_institutions_path(id)}/#{method}"
|
57
48
|
super params, path
|
58
49
|
end
|
50
|
+
|
51
|
+
def user_institutions_path(id)
|
52
|
+
"#{END_POINT}/#{ERB::Util.url_encode(id)}"
|
53
|
+
end
|
59
54
|
end
|
60
55
|
end
|
61
56
|
end
|