diff options
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index d09af26..215792a 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -39,6 +39,12 @@ module API end end + def update_runner_info + return unless params["info"].present? + info = attributes_for_keys(["name", "version", "revision", "platform", "architecture"], params["info"]) + current_runner.update(info) + end + # Checks the occurrences of required attributes, each attribute must be present in the params hash # or a Bad Request error is invoked. # @@ -50,10 +56,11 @@ module API end end - def attributes_for_keys(keys) + def attributes_for_keys(keys, custom_params = nil) + params_hash = custom_params || params attrs = {} keys.each do |key| - attrs[key] = params[key] if params[key].present? + attrs[key] = params_hash[key] if params_hash[key].present? end attrs end |