Sha256: b0b62051c3a34bd74a32a4dcfe016631fd96d09c172b5c8bbd04420048943437

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

module HerokuPgBackupsArchive
  class Backup
    def self.create
      backup_output = ToolbeltHelper.capture_backup
      new(backup_output)
    end

    attr_reader :id

    def initialize(backup_output)
      @id = extract_id(backup_output)
    end

    def url
      @url ||= ToolbeltHelper.fetch_backup_public_url(id).chomp
    end

    def finished_at
      @finished_at ||= begin
        info = ToolbeltHelper.fetch_backup_info(id)
        Time.parse(info.match(/Finished:\s*(.*)\n/)[1])
      end
    end

    private

    def extract_id(backup_output)
      backup_output.match(/Backing up .* to (.*)... done\n/)[1]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heroku_pg_backups_archive-0.3.2 lib/heroku_pg_backups_archive/backup.rb