Class: Maia::Message
- Inherits:
-
Object
- Object
- Maia::Message
- Defined in:
- lib/maia/message.rb
Direct Known Subclasses
Instance Method Summary collapse
- #background? ⇒ Boolean
- #badge ⇒ Object
- #body ⇒ Object
- #color ⇒ Object
- #data ⇒ Object
- #image ⇒ Object
- #priority ⇒ Object
- #send_to(*models, topic: nil, token: nil, messenger: Maia.messenger) ⇒ Object
- #sound ⇒ Object
- #targeting(target) ⇒ Object
- #title ⇒ Object
- #to_json ⇒ Object
Instance Method Details
#background? ⇒ Boolean
8 |
# File 'lib/maia/message.rb', line 8 def background?; end |
#badge ⇒ Object
6 |
# File 'lib/maia/message.rb', line 6 def badge; end |
#body ⇒ Object
4 |
# File 'lib/maia/message.rb', line 4 def body; end |
#color ⇒ Object
7 |
# File 'lib/maia/message.rb', line 7 def color; end |
#data ⇒ Object
11 12 13 |
# File 'lib/maia/message.rb', line 11 def data {} end |
#image ⇒ Object
5 |
# File 'lib/maia/message.rb', line 5 def image; end |
#priority ⇒ Object
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 |
#sound ⇒ Object
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 |
#title ⇒ Object
3 |
# File 'lib/maia/message.rb', line 3 def title; end |
#to_json ⇒ Object
23 24 25 |
# File 'lib/maia/message.rb', line 23 def to_json to_h.to_json end |