Class: Heroku::Postgres::Database
- Defined in:
- lib/heroku/postgres/database.rb
Overview
Representation and handling of Database objects
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#database_name ⇒ Object
Returns the value of attribute database_name.
-
#database_password ⇒ Object
Returns the value of attribute database_password.
-
#database_user ⇒ Object
Returns the value of attribute database_user.
-
#db ⇒ Object
Returns the value of attribute db.
-
#resource_url ⇒ Object
Returns the value of attribute resource_url.
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
#app ⇒ Object
Returns the value of attribute app.
5 6 7 |
# File 'lib/heroku/postgres/database.rb', line 5 def app @app end |
#database_name ⇒ Object
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_password ⇒ Object
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_user ⇒ Object
Returns the value of attribute database_user.
6 7 8 |
# File 'lib/heroku/postgres/database.rb', line 6 def database_user @database_user end |
#db ⇒ Object
Returns the value of attribute db.
5 6 7 |
# File 'lib/heroku/postgres/database.rb', line 5 def db @db end |
#resource_url ⇒ Object
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
#backups ⇒ Object
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 |