Module: DockerSwarm::Concerns::Updatable

Extended by:
ActiveSupport::Concern
Included in:
Network, Node, Service
Defined in:
lib/docker_swarm/concerns/updatable.rb

Instance Method Summary collapse

Instance Method Details

#update(new_attributes = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/docker_swarm/concerns/updatable.rb', line 8

def update(new_attributes = {})
  assign_attributes(new_attributes) if new_attributes.present?
  return false unless valid?

  Api.request(
    action: self.class.routes[:update],
    arguments: { id: self.ID },
    query_params: { version: self.Version&.dig("Index") },
    payload: payload_for_docker
  )

  true
end