Class: Firepush::MessageType::Notification

Inherits:
Base
  • Object
show all
Defined in:
lib/firepush/message_type/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#key

Constructor Details

#initialize(title:, body:) ⇒ Notification

Returns a new instance of Notification.

Parameters:

  • :title (String)
  • :body (String)


11
12
13
14
# File 'lib/firepush/message_type/notification.rb', line 11

def initialize(title:, body:)
  @title = title
  @body  = body
end

Instance Attribute Details

#bodyString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/firepush/message_type/notification.rb', line 7

def body
  @body
end

#titleString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/firepush/message_type/notification.rb', line 6

def title
  @title
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/firepush/message_type/notification.rb', line 18

def valid?
  valid_str?(title) && valid_str?(body)
end

#valueHash

Returns:

  • (Hash)


24
25
26
# File 'lib/firepush/message_type/notification.rb', line 24

def value
  { title: title, body: body }
end