Class: Heroku::Api::Postgres::Databases

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/api/postgres/databases.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Databases

Returns a new instance of Databases.



8
9
10
# File 'lib/heroku/api/postgres/databases.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#info(database_id) ⇒ Object



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

def info(database_id)
  @client.perform_get_request("/client/v11/databases/#{database_id}")
end

#wait(database_id, options = { wait_interval: 3 }) ⇒ Object

original call returns simply a database object, therefore I call the info API. perform_get_request “/client/v11/databases/#database_id/wait_status”



14
15
16
17
18
19
20
21
22
# File 'lib/heroku/api/postgres/databases.rb', line 14

def wait(database_id, options = { wait_interval: 3 })
  waiting = true
  while waiting do
    database = info(database_id)
    break unless database[:waiting?]
    sleep(options[:wait_interval])
  end
  database
end