class Object

Public Instance Methods

branch_name() click to toggle source
# File lib/mina/twist/tasks.rb, line 41
def branch_name
  "#{fetch(:branch)} (#{fetch(:commit).call})"
end
post_twist_thread(message) click to toggle source
# File lib/mina/twist/tasks.rb, line 45
def post_twist_thread(message)
  uri = URI.parse(fetch(:twist_url))
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  payload = {
    content: message
  }
  headers = {'Content-Type': 'application/json'}

  request = Net::HTTP::Post.new(uri.request_uri, headers)
  request.body = payload.to_json

  # Call Twist webhook
  http.request(request)
rescue => e
  puts "Failed to notify Twist. Error #{e.inspect}"
end