Class: Heroku::Postgres::Database

Inherits:
Resource
  • Object
show all
Defined in:
lib/heroku/postgres/database.rb

Overview

Representation and handling of Database objects

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#initialize, #inspect, #to_hash, #update_with_response

Constructor Details

This class inherits a constructor from Heroku::Postgres::Resource

Instance Attribute Details

#appObject

Returns the value of attribute app.



5
6
7
# File 'lib/heroku/postgres/database.rb', line 5

def app
  @app
end

#database_nameObject

Returns the value of attribute database_name.



6
7
8
# File 'lib/heroku/postgres/database.rb', line 6

def database_name
  @database_name
end

#database_passwordObject

Returns the value of attribute database_password.



6
7
8
# File 'lib/heroku/postgres/database.rb', line 6

def database_password
  @database_password
end

#database_userObject

Returns the value of attribute database_user.



6
7
8
# File 'lib/heroku/postgres/database.rb', line 6

def database_user
  @database_user
end

#dbObject

Returns the value of attribute db.



5
6
7
# File 'lib/heroku/postgres/database.rb', line 5

def db
  @db
end

#resource_urlObject

Returns the value of attribute resource_url.



6
7
8
# File 'lib/heroku/postgres/database.rb', line 6

def resource_url
  @resource_url
end

Class Method Details

.find(app_name, db_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/heroku/postgres/database.rb', line 9

def self.find(app_name, db_name)
  response = Postgres.pg_client.get("/databases/#{db_name}")

  db = new(JSON.parse(response.body))

  db.db = db_name
  db.app = app_name

  db
end

Instance Method Details

#backupsObject



24
25
26
# File 'lib/heroku/postgres/database.rb', line 24

def backups
  Backup.all_for_app(app)
end

#capture_backup(poll = false, &block) ⇒ Object



20
21
22
# File 'lib/heroku/postgres/database.rb', line 20

def capture_backup(poll = false, &block)
  Backup.capture(app, db, poll, &block)
end