class Escobar::Heroku::Dynos

Class representing an app's dyno state

Constants

ONE_OFF_TYPES

Attributes

app_id[R]
client[R]
command_id[RW]
github_url[RW]
pipeline_name[RW]

Public Class Methods

new(client, app_id) click to toggle source
# File lib/escobar/heroku/dynos.rb, line 13
def initialize(client, app_id)
  @app_id = app_id
  @client = client
end

Public Instance Methods

info() click to toggle source
# File lib/escobar/heroku/dynos.rb, line 18
def info
  @info ||= client.heroku.get("/apps/#{app_id}/dynos")
end
newer_than?(epoch) click to toggle source
# File lib/escobar/heroku/dynos.rb, line 38
def newer_than?(epoch)
  non_one_off.all? do |dyno|
    epoch < Time.parse(dyno["created_at"]).utc
  end
end
non_one_off() click to toggle source
# File lib/escobar/heroku/dynos.rb, line 22
def non_one_off
  info.reject { |dyno| ONE_OFF_TYPES.include?(dyno["type"]) }
end
running?(release_id) click to toggle source
# File lib/escobar/heroku/dynos.rb, line 26
def running?(release_id)
  non_one_off.all? do |dyno|
    dyno["release"]["id"] == release_id && dyno["state"] == "up"
  end
end
running_at_least?(version) click to toggle source
# File lib/escobar/heroku/dynos.rb, line 32
def running_at_least?(version)
  non_one_off.all? do |dyno|
    dyno["release"]["version"] >= version && dyno["state"] == "up"
  end
end