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.1.11 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.10 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.9 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.8 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.7 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.6 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.5 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.4 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.3 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.2 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.1 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.1.0 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.0.5 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.0.4 lib/ey-core/requests/apply_environment_updates.rb
ey-core-3.0.3 lib/ey-core/requests/apply_environment_updates.rb