Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
73f7685a
authored
Nov 08, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixed bug for adding joule nodes without a proxy
parent
07bce4d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
app/services/nilm/add_nilm_by_key.rb
app/services/nilm/add_nilm_by_user.rb
app/services/nilm/add_nilm_by_key.rb
View file @
73f7685a
...
...
@@ -10,10 +10,13 @@ class AddNilmByKey
required_keys
=
[
:port
,
:scheme
,
:
base_uri
,
:
name
,
:api_key
,
:auth_key
]
[
:port
,
:scheme
,
:name
,
:api_key
,
:auth_key
]
joule_params
=
request_params
.
permit
(
required_keys
+
[
:name_is_host
])
joule_params
=
request_params
.
permit
(
required_keys
+
[
:name_is_host
,
:base_uri
])
# since we're not explicitly checking for base_uri, give it a default value
# it should always be present but may be "" which causes the require action to fail
joule_params
[
:base_uri
]
=
""
if
joule_params
[
:base_uri
].
nil?
begin
required_keys
.
each
{
|
key
|
joule_params
.
require
(
key
)}
...
...
app/services/nilm/add_nilm_by_user.rb
View file @
73f7685a
...
...
@@ -14,10 +14,14 @@ class AddNilmByUser
#0 make sure parameters are present
required_keys
=
[
:port
,
:scheme
,
:
base_uri
,
:
name
,
:api_key
]
+
[
:port
,
:scheme
,
:name
,
:api_key
]
+
[
:first_name
,
:last_name
,
:email
,
:password
]
request_params
=
request_params
.
permit
(
required_keys
+
[
:name_is_host
])
request_params
=
request_params
.
permit
(
required_keys
+
[
:name_is_host
,
:base_uri
])
# since we're not explicitly checking for base_uri, give it a default value
# it should always be present but may be "" which causes the require action to fail
request_params
[
:base_uri
]
=
""
if
request_params
[
:base_uri
].
nil?
begin
required_keys
.
each
{
|
key
|
request_params
.
require
(
key
)}
rescue
ActionController
::
ParameterMissing
=>
e
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment