Last active
October 30, 2015 11:18
-
-
Save StlTenny/a1d2403978e7ec194457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require ‘net/http’ | |
require ‘cgi’ | |
class StatusMessage | |
attr_accessor :status, :status_endpoint | |
end | |
def whyrun_supported? | |
true | |
end | |
action :run do | |
converge_by(“Posting Status Update of “#{resource.status}”) do | |
notify_endpoint | |
end | |
end | |
def notify_endpoint | |
resource.query_params[“status”] = resource.status | |
query_url = resource.status_endpoint + “?” + resource.query_params.map{|k,v| “#{k}={v}”}*”&” | |
uri = URI.parse(query_url) | |
http = Net::HTTP.new(uri.host,uri.port) | |
// additional implementation of notify here | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment