Class: GetaroundUtils::Utils::HttpReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/getaround_utils/utils/http_reporter.rb

Defined Under Namespace

Classes: AsyncQueue

Instance Method Summary collapse

Constructor Details

#initialize(url:) ⇒ HttpReporter

Returns a new instance of HttpReporter.



15
16
17
# File 'lib/getaround_utils/utils/http_reporter.rb', line 15

def initialize(url:)
  @url = url
end

Instance Method Details

#report(event) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/getaround_utils/utils/http_reporter.rb', line 19

def report(event)
  AsyncQueue.perform_async(
    url: @url,
    headers: { 'Content-Type' => 'application/json' },
    body: JSON.generate(event)
  )
end