lib/web_push.rb in web-push-1.0.0 vs lib/web_push.rb in web-push-2.0.0

- old
+ new

@@ -1,19 +1,20 @@ # frozen_string_literal: true require 'openssl' require 'base64' require 'hkdf' +require 'jwt' +require 'uri' require 'net/http' require 'json' require 'web_push/version' require 'web_push/errors' require 'web_push/vapid_key' require 'web_push/encryption' require 'web_push/request' -require 'web_push/railtie' if defined?(Rails) # Push API implementation # # https://tools.ietf.org/html/rfc8030 # https://www.w3.org/TR/push-api/ @@ -32,19 +33,17 @@ # @option vapid [String] :public_key the VAPID public key # @option vapid [String] :private_key the VAPID private key # @param options [Hash<Symbol,String>] additional options for the notification # @option options [#to_s] :ttl Time-to-live in seconds # @option options [#to_s] :urgency Urgency can be very-low, low, normal, high - # rubocop:disable Metrics/ParameterLists def payload_send(message: '', endpoint:, p256dh: '', auth: '', vapid: {}, **options) WebPush::Request.new( message: message, subscription: subscription(endpoint, p256dh, auth), vapid: vapid, **options ).perform end - # rubocop:enable Metrics/ParameterLists # Generate a VapidKey instance to obtain base64 encoded public and private keys # suitable for VAPID protocol JSON web token signing # # @return [WebPush::VapidKey] a new VapidKey instance