Sha256: 21786e918149070546f10ab6763ec29837758b2d32cb674edc997f8fdfde1c7f

Contents?: true

Size: 1.31 KB

Versions: 35

Compression:

Stored size: 1.31 KB

Contents

class Ey::Core::Client
  class Real
    def apply_environment_updates(options={})
      id  = options.delete("id")
      url = options.delete("url")

      request(
        :path   => "environments/#{id}/apply",
        :method => :post,
        :url    => url,
        :body   => options,
      )
    end
  end

  class Mock
    def apply_environment_updates(options={})
      id          = options.delete("id")
      servers     = get_servers("environment" => id).body["servers"]
      request_id  = self.uuid

      servers.each do |server|
        update_id = self.uuid
        self.data[:instance_updates][update_id] = {
          "id"          => update_id,
          "instance_id" => server["id"],
          "data"        => {
            "type" => options["type"] || "main",
          }
        }
      end

      request = {
        "id"           => request_id,
        "type"         => "configure_environment",
        "successful"   => true,
        "started_at"   => Time.now,
        "finished_at"  => Time.now,
        "resource_url" => nil,
        "resource"     => nil,
      }

      self.data[:requests][request_id] = request

      response_hash = request.dup
      response_hash.delete("resource")

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

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
ey-core-3.6.4 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.6.3 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.6.1 lib/ey-core/requests/apply_environment_updates.rb
groove-ey-core-3.6.3 lib/ey-core/requests/apply_environment_updates.rb
groove-ey-core-3.6.2 lib/ey-core/requests/apply_environment_updates.rb
groove-ey-core-3.6.1 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.5.0 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.4.4 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.4.2 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.4.1 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.4.0 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.3.1 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.3.0 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.6 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.5 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.4 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.3 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.2 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.1 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.2.0 lib/ey-core/requests/apply_environment_updates.rb