lib/vra/request_parameters.rb in vmware-vra-2.7.2 vs lib/vra/request_parameters.rb in vmware-vra-3.0.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
#
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
-# Copyright:: Copyright (c) 2015 Chef Software, Inc.
+# Copyright:: Copyright (c) 2022 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -91,15 +91,15 @@
hash
end
def to_vra
hash = {
- "data" => {},
+ 'inputs': {}
}
- @entries.each do |k, v|
- hash["data"].merge!(v.to_vra)
+ @entries.each do |_, v|
+ hash[:inputs].merge!(v.to_vra)
end
hash
end
end
@@ -118,11 +118,11 @@
end
def to_h
hash = {}
- if @children.count > 0
+ if @children.count.positive?
hash[@key] = {}
@children.each do |c|
hash[@key].merge!(c.to_h)
end
@@ -133,32 +133,32 @@
hash
end
def to_vra
hash = {}
- if @children.count > 0
+ if @children.count.positive?
hash[@key] = {}
- hash[@key]["data"] = {}
+ hash[@key]['inputs'] = {}
@children.each do |c|
- hash[@key]["data"].merge!(c.to_vra)
+ hash[@key]['inputs'].merge!(c.to_vra)
end
else
hash[@key] = format_value
end
hash.each_with_object({}) { |(key, value), h| h[key.to_s] = value }
end
def format_value
case @type
- when "integer"
+ when 'integer'
@value.to_i
- when "string"
+ when 'string'
@value
- when "boolean"
- @value.to_s == "true"
+ when 'boolean'
+ @value.to_s == 'true'
else
@value
end
end
end