app/services/notifier.rb
# DMs users about Locations in zip codes they follow.
#
# @return [Hash] the message and number of Locations and users DM'd
# @example
#   Notifier.call
#     => {
#         :locations => 10,
#         :message => ["Appointments now available at:", ...]
#           :users => 18
#     }
DMs users about Locations in zip codes they follow.
DMs users about Locations in zip codes they follow .
def call
    results = { locations: 0, users: 0 }
    @user_zips.each do |user_zip|
      results[:user_zip] = user_zip
      next unless message_for_matching_locations(results)
      results[:message] << DM_FOOTER
      dm_results(results)
      results[:message] = nil
    end
    Rails.logger.info "Notified #{results[:users]} users about #{results[:locations]} Locations."
    { locations: results[:locations], users: results[:users] }
  end
def call results = { locations : 0 , users : 0 } @user_zips . each do | user_zip | results [ :user_zip ] = user_zip next unless message_for_matching_locations ( results ) results [ :message ] << DM_FOOTER dm_results ( results ) results [ :message ] = nil end Rails . logger . info "Notified #{results[:users]} users about #{results[:locations]} Locations." { locations : results [ :locations ] , users : results [ :users ] } end
DMs users about Locations in zip codes they follow.
DMs users about Locations in zip codes they follow .
the message and number of Locations and users DM'd
the message and number of Locations and users DM ' d
Hash
example
Notifier.call => { :locations => 10, :message => ["Appointments now available at:", ...] :users => 18 }
Notifier . call = > { : locations = > 10 : message = > [ " Appointments now available at : " ... ] : users = > 18 }