Module: Rpush::Client::ActiveModel::Webpush::App

Included in:
Rpush::Client::ActiveRecord::Webpush::App, Redis::Webpush::App
Defined in:
lib/rpush/client/active_model/webpush/app.rb

Defined Under Namespace

Classes: VapidKeypairValidator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/rpush/client/active_model/webpush/app.rb', line 21

def self.included(base)
  base.class_eval do
    alias_attribute :vapid_keypair, :certificate
    validates :vapid_keypair, presence: true
    validates_with VapidKeypairValidator
  end
end

Instance Method Details

#service_nameObject



29
30
31
# File 'lib/rpush/client/active_model/webpush/app.rb', line 29

def service_name
  'webpush'
end

#vapidObject



33
34
35
# File 'lib/rpush/client/active_model/webpush/app.rb', line 33

def vapid
  @vapid ||= JSON.parse(vapid_keypair).symbolize_keys
end