class Heroku::Api::Postgres::Databases
Constants
- PRO_HOST
- STARTER_HOST
Public Class Methods
new(client)
click to toggle source
# File lib/heroku/api/postgres/databases.rb, line 11 def initialize(client) @client = client end
Public Instance Methods
host_for(database)
click to toggle source
# File lib/heroku/api/postgres/databases.rb, line 32 def host_for(database) starter_plan?(database) ? STARTER_HOST : PRO_HOST end
info(database_id)
click to toggle source
# File lib/heroku/api/postgres/databases.rb, line 28 def info(database_id) @client.perform_get_request("/client/v11/databases/#{database_id}") end
starter_plan?(database)
click to toggle source
# File lib/heroku/api/postgres/databases.rb, line 36 def starter_plan?(database) database['plan']['name'].match(/(dev|basic)$/) end
wait(database_id, options = { wait_interval: 3 })
click to toggle source
original call returns simply a database object, therefore I call the info API. perform_get_request “/client/v11/databases/#{database_id}/wait_status”
# File lib/heroku/api/postgres/databases.rb, line 17 def wait(database_id, options = { wait_interval: 3 }) waiting = true while waiting database = info(database_id) break unless database[:waiting?] sleep(options[:wait_interval]) end database end