Module: Kuromd::Postable

Included in:
OneOnOne::Note
Defined in:
lib/kuromd/postable.rb

Overview

Post @note_data to a url

Instance Method Summary collapse

Instance Method Details

#send(url, note_data) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kuromd/postable.rb', line 9

def send(url, note_data)
  uri = URI.parse(url)

  conn = Faraday.new(
    url: "#{uri.scheme}://#{uri.host}",
    params: note_data,
    headers: { 'Content-Type' => 'application/json' }
  )

  Kuromd::logger.info "Sending data to #{uri.path}"
  conn.post(uri.path, '')
end