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
0202fd3d
authored
Aug 30, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added support for sub-uri joule installations
parent
ec016c43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 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 @
0202fd3d
...
@@ -10,7 +10,7 @@ class AddNilmByKey
...
@@ -10,7 +10,7 @@ class AddNilmByKey
required_keys
=
required_keys
=
[
:port
,
:scheme
,
:name
,
:api_key
,
:auth_key
]
[
:port
,
:scheme
,
:
base_uri
,
:
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
])
...
@@ -38,6 +38,7 @@ class AddNilmByKey
...
@@ -38,6 +38,7 @@ class AddNilmByKey
url
.
host
=
host
url
.
host
=
host
url
.
port
=
joule_params
[
:port
]
url
.
port
=
joule_params
[
:port
]
url
.
scheme
=
joule_params
[
:scheme
]
url
.
scheme
=
joule_params
[
:scheme
]
url
.
path
=
joule_params
[
:base_uri
]
#3 Create the Nilm
#3 Create the Nilm
adapter
=
Joule
::
Adapter
.
new
(
url
,
joule_params
[
:api_key
])
adapter
=
Joule
::
Adapter
.
new
(
url
,
joule_params
[
:api_key
])
service
=
CreateNilm
.
new
(
adapter
)
service
=
CreateNilm
.
new
(
adapter
)
...
...
app/services/nilm/add_nilm_by_user.rb
View file @
0202fd3d
...
@@ -14,7 +14,7 @@ class AddNilmByUser
...
@@ -14,7 +14,7 @@ class AddNilmByUser
#0 make sure parameters are present
#0 make sure parameters are present
required_keys
=
required_keys
=
[
:port
,
:scheme
,
:name
,
:api_key
]
+
[
:port
,
:scheme
,
:
base_uri
,
:
name
,
:api_key
]
+
[
:first_name
,
:last_name
,
:email
,
:password
]
[
: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
])
...
@@ -41,6 +41,7 @@ class AddNilmByUser
...
@@ -41,6 +41,7 @@ class AddNilmByUser
url
.
host
=
host
url
.
host
=
host
url
.
port
=
request_params
[
:port
]
url
.
port
=
request_params
[
:port
]
url
.
scheme
=
request_params
[
:scheme
]
url
.
scheme
=
request_params
[
:scheme
]
url
.
path
=
request_params
[
:base_uri
]
#3 Create the Nilm
#3 Create the Nilm
adapter
=
Joule
::
Adapter
.
new
(
url
,
request_params
[
:api_key
])
adapter
=
Joule
::
Adapter
.
new
(
url
,
request_params
[
:api_key
])
service
=
CreateNilm
.
new
(
adapter
)
service
=
CreateNilm
.
new
(
adapter
)
...
...
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