Class: EbDeployer::EbEventSource

Inherits:
Object
  • Object
show all
Defined in:
lib/eb_deployer/eb_event_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env, eb_driver) ⇒ EbEventSource

Returns a new instance of EbEventSource.



3
4
5
# 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

Instance Method Details

#fetch_events(from_anchor, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
# 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_anchorObject



7
8
9
10
# File 'lib/eb_deployer/eb_event_source.rb', line 7

def get_anchor
  events, _ = fetch_events_from_eb(:max_records => 1)
  events.first
end