require 'net/http'

module ServiceChangeNotifier
  def notify_services_of_changes
    Service.all.each do |s|
      next if s.url.nil?
      request = Net::HTTP.post_form(URI(s.url),
                                    'services' =>
                                      Service.all.to_json(include: :models))
      if request.nil?
        Net::HTTP.post_form(URI(s.url),
                            'error' => 'Request is nil')
      elsif request == Net::HTTPSuccess
      else
        send_mail(s, status)
        request.retry
      end
    end
  end
end

require 'net/http'

module ServiceChangeNotifier
  def notify_services_of_changes
    Service.all.each do |s|
      next if s.url.nil?
      request = Net::HTTP.post_form(URI(s.url),
                                    'services' =>
                                      Service.all.to_json(include: :models))
      if request.nil?
        Net::HTTP.post_form(URI(s.url),
                            'error' => 'Request is nil')
      elsif request == Net::HTTPSuccess
      else
        send_mail(s.url, status)
        request.retry
      end
    end
  end
end

Use service url instead of service
Use service url instead of service
