Class: Ey::Core::Client::EnvironmentVariable

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/environment_variable.rb

Instance Method Summary collapse

Methods included from Associations

assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader

Methods inherited from Model

#destroy, range_parser, #save, #to_s, #update!, #url

Instance Method Details

#save!Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ey-core/models/environment_variable.rb', line 17

def save!
  requires :name, :value
  params = Cistern::Hash.slice(Cistern::Hash.stringify_keys(attributes), "id", "name", "value")

  if new_record?
    requires :application_id, :environment_id
    params.merge!("application_id" => application_id, "environment_id" => environment_id)
    merge_attributes(self.connection.create_environment_variable(params).body["environment_variable"])
  else
    merge_attributes(self.connection.update_environment_variable(params).body["environment_variable"])
  end
end