module ActionPush::Concerns::ClassMethodDelivery

Public Instance Methods

action_methods() click to toggle source
# File lib/action_push/concerns/class_method_delivery.rb, line 36
def action_methods
  @action_methods ||= public_instance_methods(false).to_set
end
method_missing(method, *argv, &block) click to toggle source

Acts like ActionMailer::Base

class ApplePush < ActionPush

def welcome
  # ....
end

end

ApplePush.new.welcome will build PUSH message, but not send it ApplePush.welcome will build PUSH message and DELIVER it

@return [Envelope]

Calls superclass method
# File lib/action_push/concerns/class_method_delivery.rb, line 18
def method_missing(method, *argv, &block)
  return super unless action_methods.include?(method)

  instance = new(action_name: method)
  instance.public_send(method, *argv, &block)
  instance.envelope.pushes.each do |provider, push|
    interceptor.call(instance, provider, push) do
      push.deliver
    end
  end

  instance.envelope
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/action_push/concerns/class_method_delivery.rb, line 32
def respond_to_missing?(method_name, include_private = false)
  action_methods.include?(method_name) || super
end