class Slax::Payload
Public Class Methods
new(url, payload)
click to toggle source
# File lib/slax/payload.rb, line 5 def initialize(url, payload) @url = url @payload = payload end
Public Instance Methods
send()
click to toggle source
# File lib/slax/payload.rb, line 10 def send build_and_send end
send!()
click to toggle source
# File lib/slax/payload.rb, line 14 def send! response = build_and_send if response.code == 200 response else raise SendError end end
Private Instance Methods
build_and_send()
click to toggle source
# File lib/slax/payload.rb, line 25 def build_and_send ::HTTParty.post(@url.to_s, body: @payload.to_json, headers: { 'Content-Type' => 'application/json' }) end