You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mpns_connection.rb
    path of file: ./repos/ruby-push-notifications/lib/ruby-push-notifications/mpns
    
    the code of the file until where you have to start completion: require 'uri'
require 'net/https'

module RubyPushNotifications
  module MPNS
    # Encapsulates a connection to the MPNS service
    # Responsible for final connection with the service.
    #
    class MPNSConnection

      # @private Content-Type HTTP Header string
      CONTENT_TYPE_HEADER  = 'Content-Type'

      # @private text/xml content type
      X_NOTIFICATIO
    
      def self.post(n, cert = nil, options = {})
        headers = build_headers(n.data[:type], n.data[:delay])
        body = n.as_mpns_xml
        responses = []
        n.each_device do |url|
          http = Net::HTTP.new url.host, url.port
          http.open_timeout = options.fetch(:open_timeout, 30)
          http.read_timeout = options.fetch(:read_timeout, 30)
          if cert && url.scheme == 'https'
            http.use_ssl = true
            http.verify_mode = OpenSSL::SSL::VERIFY_PEER
            http.ca_file = cert
          end
          response = http.post url.path, body, headers
          responses << { device_url: url.to_s, headers: extract_headers(response), code: response.code.to_i }
        end