Class: Maia::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/maia/message.rb

Direct Known Subclasses

Poke

Instance Method Summary collapse

Instance Method Details

#background?Boolean

Returns:

  • (Boolean)

8
# File 'lib/maia/message.rb', line 8

def background?; end

#badgeObject


6
# File 'lib/maia/message.rb', line 6

def badge; end

#bodyObject


4
# File 'lib/maia/message.rb', line 4

def body;  end

#colorObject


7
# File 'lib/maia/message.rb', line 7

def color; end

#dataObject


11
12
13
# File 'lib/maia/message.rb', line 11

def data
  {}
end

#imageObject


5
# File 'lib/maia/message.rb', line 5

def image; end

#priorityObject


9
# File 'lib/maia/message.rb', line 9

def priority; end

#send_to(*models, topic: nil, token: nil, messenger: Maia.messenger) ⇒ Object


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/maia/message.rb', line 27

def send_to(*models, topic: nil, token: nil, messenger: Maia.messenger)
  targets = []
  targets << Maia::Topic.new(topic) if topic
  targets << Maia::Token.new(token) if token

  Maia::Devices.new(models).each do |t|
    targets << t
  end

  targets.map do |target|
    messenger.deliver Maia.gateway.serialize(self, target)
  end
end

#soundObject


15
16
17
# File 'lib/maia/message.rb', line 15

def sound
  'default'
end

#targeting(target) ⇒ Object


19
20
21
# File 'lib/maia/message.rb', line 19

def targeting(target)
  tap { @target = target }
end

#titleObject


3
# File 'lib/maia/message.rb', line 3

def title; end

#to_jsonObject


23
24
25
# File 'lib/maia/message.rb', line 23

def to_json
  to_h.to_json
end