Method: Lowdown::Mock.client

Defined in:
lib/lowdown/mock.rb

.client(uri: nil, app_bundle_id: "com.example.MockApp", keep_alive: false) ⇒ Client

Generates a Client with a mock Connection and a self-signed Universal Certificate.

Parameters:

  • uri (URI, String) (defaults to: nil)

    the details to connect to the APN service.

  • app_bundle_id (String) (defaults to: "com.example.MockApp")

    the App ID / app Bundle ID to encode into the certificate.

Returns:

  • (Client)

    a Client configured with the uri and a self-signed certificate that has the app_bundle_id encoded.

[View source]

66
67
68
69
70
71
# File 'lib/lowdown/mock.rb', line 66

def self.client(uri: nil, app_bundle_id: "com.example.MockApp", keep_alive: false)
  certificate = certificate(app_bundle_id)
  connection = Connection.new(uri, certificate.ssl_context, keep_alive)
  connection.connect if keep_alive
  Client.client_with_connection(connection, certificate: certificate)
end