Class: HerokuPgBackupsArchive::Backup

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku_pg_backups_archive/backup.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backup_output) ⇒ Backup

Returns a new instance of Backup.



10
11
12
# File 'lib/heroku_pg_backups_archive/backup.rb', line 10

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/heroku_pg_backups_archive/backup.rb', line 8

def id
  @id
end

Class Method Details

.createObject



3
4
5
6
# File 'lib/heroku_pg_backups_archive/backup.rb', line 3

def self.create
  backup_output = ToolbeltHelper.capture_backup
  new(backup_output)
end

Instance Method Details

#finished_atObject



18
19
20
21
22
23
# File 'lib/heroku_pg_backups_archive/backup.rb', line 18

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

#urlObject



14
15
16
# File 'lib/heroku_pg_backups_archive/backup.rb', line 14

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