Sha256: b550947cb441c66652755fe4c68249777b6cfba7e0c9d2632a87fb125c3483cb

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 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(/---backup---> (.*)\n/)[1]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heroku_pg_backups_archive-0.3.0 lib/heroku_pg_backups_archive/backup.rb
heroku_pg_backups_archive-0.2.2 lib/heroku_pg_backups_archive/backup.rb
heroku_pg_backups_archive-0.2.1 lib/heroku_pg_backups_archive/backup.rb