class Firepush::MessageTypes
Attributes
types[R]
Public Class Methods
new(args)
click to toggle source
@param args [Hash] @option args [Hash] :notification @option args [Hash] :data
# File lib/firepush/message_types.rb, line 10 def initialize(args) valid_types = MessageType::TYPES.reduce([]) do |acc, type| acc.push(type => args[type]) if args.key?(type) acc end @types = valid_types.map { |type| MessageType::Builder.build(type) } end
Public Instance Methods
message()
click to toggle source
@return [Hash]
# File lib/firepush/message_types.rb, line 20 def message types.reduce({}) do |acc, type| acc[type.key] = type.value acc end end
valid?()
click to toggle source
@return [Boolean]
# File lib/firepush/message_types.rb, line 28 def valid? types.count > 0 && types.all?(&:valid?) end