Module: Racoon::Payload

Included in:
Notification
Defined in:
lib/racoon/payload.rb

Constant Summary collapse

PayloadInvalid =
Class.new(RuntimeError)

Instance Method Summary collapse

Instance Method Details

#create_payload(payload) ⇒ Object



10
11
12
13
14
15
# File 'lib/racoon/payload.rb', line 10

def create_payload(payload)
  case payload
    when String then { :aps => { :alert =>  payload } }
    when Hash then create_payload_from_hash(payload)
  end
end

#create_payload_from_hash(payload) ⇒ Object



17
18
19
20
21
22
# File 'lib/racoon/payload.rb', line 17

def create_payload_from_hash(payload)
  custom = payload.delete(:custom)
  aps = {:aps => payload }
  aps.merge!(custom) if custom
  aps
end