Sha256: 9817a32f0607eca4a25bd0f7ed4f6489f7bfa547dc43d84e10a98f4569a8dcc0
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module FiveMobilePush # @private Used internally. You'll never use this class directly. # Documented for the benefit of contributors. class Payload attr_reader :message attr_accessor :meta_data # @param [#to_s] message The message you wish to send with a notice # @param [Hash] meta_data (nil) Any meta data to send along with the # notice. Leave as +nil+ if none is to be sent. def initialize(message, meta_data=nil) self.message = message self.meta_data = meta_data end # @param [#to_s] message The message you wish to send with a notice def message=(message) @message = message.to_s end # @return [String] JSON representation of the Payload def to_json MultiJson.encode(as_json) end private def as_json payload = { 'msg' => { 'type' => 'string', 'value' => message }, 'sound' => 'default', 'launch' => true } payload['meta'] = meta_data if meta_data payload end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
five_mobile_push-0.4.1 | lib/five_mobile_push/payload.rb |
five_mobile_push-0.4.0 | lib/five_mobile_push/payload.rb |
five_mobile_push-0.3.1 | lib/five_mobile_push/payload.rb |