Class: Maia::FCM::Platform::Android

Inherits:
Object
  • Object
show all
Defined in:
lib/maia/fcm/platform/android.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Android

Returns a new instance of Android.



5
6
7
# File 'lib/maia/fcm/platform/android.rb', line 5

def initialize(message)
  @message = message
end

Instance Method Details

#colorObject



9
10
11
# File 'lib/maia/fcm/platform/android.rb', line 9

def color
  @message.color
end

#priorityObject



17
18
19
20
21
22
23
# File 'lib/maia/fcm/platform/android.rb', line 17

def priority
  if @message.priority == :high
    :high
  else
    :normal
  end
end

#soundObject



13
14
15
# File 'lib/maia/fcm/platform/android.rb', line 13

def sound
  @message.sound
end

#to_hObject



25
26
27
28
29
30
31
32
33
# File 'lib/maia/fcm/platform/android.rb', line 25

def to_h
  {
    priority: priority.to_s,
    notification: {
      color: color,
      sound: sound,
    }.compact
  }
end