lib/mistral_client/environment.rb in mistral_client-1.3.0 vs lib/mistral_client/environment.rb in mistral_client-2.0.0
- old
+ new
@@ -6,12 +6,13 @@
PATH = 'environments'.freeze
include MistralClient::Mixins::MistralObject
include MistralClient::Mixins::Definable
def initialize(server, definition = nil, name: nil)
+ super()
@server = server
- @definition = parse_definition(definition) if definition
+ @definition = definition ? parse_definition(definition) : nil
@name = name
if @name
reload
elsif @definition
create_environment
@@ -36,12 +37,10 @@
resp = @server.post(PATH, @definition.to_json, json: true)
ivars_from_response(resp)
end
def massage_definition(definition)
- if definition['variables'].is_a? Hash
- definition['variables'] = definition['variables'].to_json
- end
+ definition['variables'] = definition['variables'].to_json if definition['variables'].is_a? Hash
definition
end
end
end