Sha256: 919319c8fbaa685effa743d5a634bd2ad2f02333dd70c696b2817bd64cc0f134

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

class Ey::Core::Client
  class Real
    def update_auto_scaling_alarm(params = {})
      id = params.delete("id")

      request(
        :method => :put,
        :path   => "/auto_scaling_alarms/#{id}",
        :body   => { "auto_scaling_alarm" => params.fetch("auto_scaling_alarm") },
      )
    end
  end

  class Mock
    def update_auto_scaling_alarm(params = {})
      resource_id = params.delete("id")
      now = Time.now
      resource = find(:auto_scaling_alarms, resource_id)
        .merge(params["auto_scaling_alarm"])
        .merge("updated_at" => now)
      resource.merge!(params)

      request = {
        "id"           => self.uuid,
        "type"         => "update_auto_scaling_alarm",
        "successful"   => true,
        "created_at"   => now - 5,
        "started_at"   => now - 3,
        "finished_at"  => now,
        "updated_at"   => now,
        "message"      => nil,
        "read_channel" => nil,
        "resource"     => [:auto_scaling_alarms, resource_id, resource],
        "resource_url" => url_for("/auto_scaling_alarms/#{resource_id}")
      }

      self.data[:requests][request["id"]] = request

      response(
        body:   { "request" => request },
        status: 200
      )
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 lib/ey-core/requests/update_auto_scaling_alarm.rb
ey-core-3.6.4 lib/ey-core/requests/update_auto_scaling_alarm.rb
ey-core-3.6.3 lib/ey-core/requests/update_auto_scaling_alarm.rb
ey-core-3.6.1 lib/ey-core/requests/update_auto_scaling_alarm.rb
groove-ey-core-3.6.3 lib/ey-core/requests/update_auto_scaling_alarm.rb
groove-ey-core-3.6.2 lib/ey-core/requests/update_auto_scaling_alarm.rb
groove-ey-core-3.6.1 lib/ey-core/requests/update_auto_scaling_alarm.rb
ey-core-3.5.0 lib/ey-core/requests/update_auto_scaling_alarm.rb