Class: ActivitySmith::Notifications

Inherits:
Object
  • Object
show all
Defined in:
lib/activitysmith/notifications.rb

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Notifications

Returns a new instance of Notifications.



5
6
7
# File 'lib/activitysmith/notifications.rb', line 5

def initialize(api)
  @api = api
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



22
23
24
25
26
# File 'lib/activitysmith/notifications.rb', line 22

def method_missing(name, *args, &block)
  return @api.public_send(name, *args, &block) if @api.respond_to?(name)

  super
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/activitysmith/notifications.rb', line 28

def respond_to_missing?(name, include_private = false)
  @api.respond_to?(name, include_private) || super
end

#send(request, opts = {}) ⇒ Object



9
10
11
12
13
# File 'lib/activitysmith/notifications.rb', line 9

def send(request, opts = {})
  normalized = normalize_channels_target(request)
  assert_valid_media_actions!(normalized)
  @api.send_push_notification(normalized, opts)
end

#send_push_notification(push_notification_request, opts = {}) ⇒ Object

Backward-compatible alias.



16
17
18
19
20
# File 'lib/activitysmith/notifications.rb', line 16

def send_push_notification(push_notification_request, opts = {})
  normalized = normalize_channels_target(push_notification_request)
  assert_valid_media_actions!(normalized)
  @api.send_push_notification(normalized, opts)
end