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
aec8cf1c
authored
Apr 21, 2018
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
adjusted API to match frontend
parent
de5f3b52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
app/models/joule_module.rb
app/services/joule_modules/update_joule_modules.rb
app/views/joule_modules/show.json.jbuilder
app/models/joule_module.rb
View file @
aec8cf1c
...
...
@@ -2,8 +2,14 @@ class JouleModule < ApplicationRecord
belongs_to
:nilm
has_many
:joule_pipes
,
dependent: :destroy
def
self
.
json_keys
# attributes accepted from the Joule json response
def
self
.
joule_keys
[
:name
,
:description
,
:web_interface
,
:exec_cmd
,
:status
,
:pid
]
end
# attributes sent to the client
def
self
.
json_keys
[
:id
,
:name
,
:description
,
:web_interface
,
:exec_cmd
,
:status
,
:pid
]
end
end
app/services/joule_modules/update_joule_modules.rb
View file @
aec8cf1c
...
...
@@ -28,7 +28,7 @@ class UpdateJouleModules
def
_build_module
(
info
)
# create JouleModule and associated pipes from
# hash returned by the JouleAdapter.module_info
params
=
info
.
extract!
(
*
JouleModule
.
j
son
_keys
)
params
=
info
.
extract!
(
*
JouleModule
.
j
oule
_keys
)
m
=
JouleModule
.
new
(
params
)
# link inputs to database streams
info
[
:input_paths
].
each
do
|
name
,
path
|
...
...
app/views/joule_modules/show.json.jbuilder
View file @
aec8cf1c
...
...
@@ -2,6 +2,7 @@ json.data do
json.array! @joule_modules do |m|
json.extract! m, *JouleModule.json_keys
json.url @url_template % [m.id]
json.nilm_id @nilm.id
end
end
...
...
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