Sha256: 38b03d0dda142a73ee32f90f4765d5518e2f638d6d803d184d0ab54da8dbd091

Contents?: true

Size: 1.13 KB

Versions: 53

Compression:

Stored size: 1.13 KB

Contents

class Ey::Core::Client
  class Real
    def destroy_environment(params={})
      id  = params["id"]
      url = params["url"]

      request(
        :method => :delete,
        :url    => url,
        :path   => "/environments/#{id}",
      )
    end
  end # Real

  class Mock
    def destroy_environment(params={})
      request_id = self.uuid
      url         = params.delete("url")

      environment_id = params["id"] || url && url.split('/').last

      environment = self.data[:environments][environment_id].dup
      environment["deleted_at"] = Time.now
      environment["resource_url"] = url_for("/environments/#{environment_id}")

      # @todo use a procedure to deprovision clusters as well

      self.data[:requests][request_id] = {
        "id"          => request_id,
        "finished_at" => nil,
        "successful"  => "true",
        "started_at"  => Time.now,
        "resource"    => [:environments, environment_id, environment],
        "type"        => "deprovision_environment",
      }

      response(
        :body   => {"request" => {id: request_id}},
        :status => 201,
      )
    end
  end # Mock
end # Ey::Core::Client

Version data entries

53 entries across 53 versions & 3 rubygems

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