class EbDeployer::EbEventSource

Public Class Methods

new(app, env, eb_driver) click to toggle source
# File lib/eb_deployer/eb_event_source.rb, line 3
def initialize(app, env, eb_driver)
  @app, @env, @eb_driver = app, env, eb_driver
end

Public Instance Methods

fetch_events(from_anchor) { |events| ... } click to toggle source
# File lib/eb_deployer/eb_event_source.rb, line 12
def fetch_events(from_anchor, &block)
  options = {}
  if from_anchor && from_anchor[:event_date]
    options[:start_time] = from_anchor[:event_date].iso8601
  end
  events, next_token = fetch_events_from_eb(options)
  should_continue = yield(events)
  fetch_next(next_token, &block) if next_token && should_continue
end
get_anchor() click to toggle source
# File lib/eb_deployer/eb_event_source.rb, line 7
def get_anchor
  events, _ = fetch_events_from_eb(:max_records => 1)
  events.first
end

Private Instance Methods

fetch_events_from_eb(options) click to toggle source
# File lib/eb_deployer/eb_event_source.rb, line 30
def fetch_events_from_eb(options)
  @eb_driver.fetch_events(@app, @env, options)
end
fetch_next(next_token) { |events| ... } click to toggle source
# File lib/eb_deployer/eb_event_source.rb, line 24
def fetch_next(next_token, &block)
  events, next_token = fetch_events_from_eb(:next_token => next_token)
  should_continue = yield(events)
  fetch_next(next_token, &block) if next_token && should_continue
end