Sha256: bde3097e8eb3a205225ddcdd29cba50d36e65a31925f1ad1cc68aff48f2f0cfb

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

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

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

  class Mock
    def deploy_environment_application(options={})
      environment_id = options.delete("id")
      application_id = options.delete("application_id")
      request_id     = self.uuid

      response(status: 422) unless self.data[:application_deployments].values.detect { |ad| ad[:environment_id] == environment_id && ad[:application_id] == application_id }

      request = {
        "id"           => request_id,
        "type"         => "app_deployment",
        "successful"   => true,
        "started_at"   => Time.now,
        "finished_at"  => nil,
        "resource_url" => url_for("/environments/#{environment_id}"),
        "resource"     => [:environments, environment_id, find(:environments, environment_id)]
      }

      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

6 entries across 6 versions & 1 rubygems

Version Path
ey-core-3.0.5 lib/ey-core/requests/deploy_environment_application.rb
ey-core-3.0.4 lib/ey-core/requests/deploy_environment_application.rb
ey-core-3.0.3 lib/ey-core/requests/deploy_environment_application.rb
ey-core-3.0.2 lib/ey-core/requests/deploy_environment_application.rb
ey-core-3.0.1 lib/ey-core/requests/deploy_environment_application.rb
ey-core-3.0.0 lib/ey-core/requests/deploy_environment_application.rb