class ActionPush::Envelope

envelope = ActionPush::Envelope.new(title: 'Alert', body: 'You ave 2 messages') envelope.add(:ios, ActionPush::Ios::Message.new)

envelope.for(:ios) do |ios|

ios.sound = 'wow.mp3'

end

Attributes

body[RW]
payload[RW]
title[RW]

Public Class Methods

new(params = {}) { |self| ... } click to toggle source
# File lib/action_push/envelope.rb, line 15
def initialize(params = {})
  params.each { |name, value| public_send("#{name}=", value) }

  yield(self) if block_given?
end

Public Instance Methods

[](provider)
Alias for: for
add(provider, push) click to toggle source
# File lib/action_push/envelope.rb, line 21
def add(provider, push)
  pushes[provider] = push
end
for(provider) { |push| ... } click to toggle source
# File lib/action_push/envelope.rb, line 25
def for(provider)
  push = pushes.fetch(provider) do
    raise ArgumentError, "provider with name <#{provider}> was not registered"
  end

  block_given? ? yield(push) : push
end
Also aliased as: []
pushes() click to toggle source
# File lib/action_push/envelope.rb, line 35
def pushes
  @pushes ||= {}
end