Commit 0202fd3d by source_reader

added support for sub-uri joule installations

parent ec016c43
...@@ -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)
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment