lib/activity_notification/apis/subscription_api.rb
# Subscribes to the specified optional target.
#
# @param [String, Symbol]  optional_target_name Symbol class name of the optional target implementation (e.g. :amazon_sns, :slack)
# @param [Hash]            options              Options for unsubscribing to the specified optional target
# @option options [DateTime] :subscribed_at (Time.current) Time to set to subscribed_[optional_target_name]_at in optional_targets hash of the subscription record
# @return [Boolean] If successfully updated subscription instance
Subscribes to the specified optional target.
Subscribes to the specified optional target .
def subscribe_to_optional_target(optional_target_name, options = {})
      subscribed_at = options[:subscribed_at] || Time.current
      update(optional_targets: optional_targets.merge(
        Subscription.to_optional_target_key(optional_target_name) => true,
        Subscription.to_optional_target_subscribed_at_key(optional_target_name) => subscribed_at)
      )
    end
def subscribe_to_optional_target ( optional_target_name , options = { } ) subscribed_at = options [ :subscribed_at ] || Time . current update ( optional_targets : optional_targets . merge ( Subscription . to_optional_target_key ( optional_target_name ) => true , Subscription . to_optional_target_subscribed_at_key ( optional_target_name ) => subscribed_at ) ) end
Subscribes to the specified optional target.
Subscribes to the specified optional target .
If successfully updated subscription instance
If successfully updated subscription instance
Boolean
optional_target_name
options
:subscribed_at (Time.current) Time to set to subscribed_[optional_target_name]_at in optional_targets hash of the subscription record
: subscribed_at ( Time . current ) Time to set to subscribed_ [ optional_target_name ] _at in optional_targets hash of the subscription record
options Options for unsubscribing to the specified optional target
options Options for unsubscribing to the specified optional target