Sha256: 733834a8c827891af27aca8bfec60ba89f0f6d93aff98f3f1b78616430fcaf7c

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

class Pulitzer::UpdateVersionStatus
  def initialize(version, status)
    @transitional_version = version
    @status = status
    @status_change_method = 'make_version_' + @status.to_s
  end

  def call
    send @status_change_method
  end

  def make_version_active
    @new_active_version = @transitional_version
    @old_active_version = @new_active_version.post.active_version
    @new_active_version.update(status: :active)
    @old_active_version.update(status: :archived) if @old_active_version
    Pulitzer::CloneVersionJob.perform_later(@new_active_version)
    @new_active_version
  end

  def make_version_abandoned
    @active_version = @transitional_version.post.active_version
    @transitional_version.update(status: :abandoned)
    Pulitzer::CloneVersionJob.perform_later(@active_version)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pulitzer-0.2.2 app/interactions/pulitzer/update_version_status.rb
pulitzer-0.2.1 app/interactions/pulitzer/update_version_status.rb
pulitzer-0.2.0 app/interactions/pulitzer/update_version_status.rb