Class: Proxy::Dynflow::Callback::Request

Inherits:
HttpRequest::ForemanRequest
  • Object
show all
Defined in:
lib/smart_proxy_dynflow/callback.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.send_to_foreman_tasks(callback, data) ⇒ Object



16
17
18
# File 'lib/smart_proxy_dynflow/callback.rb', line 16

def self.send_to_foreman_tasks(callback, data)
  self.new.callback(callback, data)
end

Instance Method Details

#callback(callback, data) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/smart_proxy_dynflow/callback.rb', line 7

def callback(callback, data)
  payload = { :callback => callback, :data => data }.to_json
  response = send_request(request_factory.create_post('foreman_tasks/api/tasks/callback', payload))
  if response.code != "200"
    raise "Failed performing callback to Foreman server: #{response.code} #{response.body}"
  end
  response
end