Class: ClickSession::StatusReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/click_session/status_reporter.rb

Constant Summary collapse

MAX_WEBHOOK_ATTEMPTS =
5

Instance Method Summary collapse

Constructor Details

#initialize(webhook) ⇒ StatusReporter

Returns a new instance of StatusReporter.



6
7
8
# File 'lib/click_session/status_reporter.rb', line 6

def initialize(webhook)
  @webhook = webhook
end

Instance Method Details

#report(click_session) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/click_session/status_reporter.rb', line 12

def report(click_session)
  @click_session = click_session

  begin
    webhook.call(
      serialized_webhook_message
    )

    @click_session.reported_back!
    notifier.session_reported(@click_session)
  rescue StandardError => e
    notifier.rescued_error(e)
    handle_webhook_failure
  end
end