Class: NotificationAction

Inherits:
NotificationsAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Notifications

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ NotificationAction

Returns a new instance of NotificationAction.



2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
# File 'lib/ruby-macrodroid/actions.rb', line 2551

def initialize(h={})
  
  h[:notification_subject] = h[:subject] if h[:subject] 
  h[:notification_text] = h[:text] if h[:text]

  options = {
    ringtone_name: 'Default',
    notification_text: '',
    notification_subject: '',
    macro_guid_to_run: 0,
    notification_channel_type: 0,
    image_resource_id: 0,
    overwrite_existing: false,
    priority: 0,
    ringtone_index: 0,
    icon_bg_color: -1762269,
    run_macro_when_pressed: false
  }

  super(options.merge filter(options, h))

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



2574
2575
2576
2577
2578
# File 'lib/ruby-macrodroid/actions.rb', line 2574

def to_s(colour: false, indent: 0)
  @s = "Display Notification\n" + \
      "%s: %s" % [@h[:notification_subject], @h[:notification_text]]
  super()
end