app/services/direct_message_reader.rb
# Reads DMs from the array of DM-attribute hashes @direct_messages.
#
# @return [Hash] results tallying subscribed and stopped zips
# @example
#   DirectMessageReader.call
#     => {
#            :stopped => 13,
#         :subscribed => 21
#     }
Reads DMs from the array of DM-attribute hashes @direct_messages.
Reads DMs from the array of DM - attribute hashes @direct_messages .
def call
    results = { stopped: 0, subscribed: 0 }
    @direct_messages.each do |dm|
      next if ReadDirectMessage.exists?(direct_message_id: dm.id)
      read(direct_message: dm, results: results)
    end
    results
  end
def call results = { stopped : 0 , subscribed : 0 } @direct_messages . each do | dm | next if ReadDirectMessage . exists? ( direct_message_id : dm . id ) read ( direct_message : dm , results : results ) end results end
Reads DMs from the array of DM-attribute hashes @direct_messages.
Reads DMs from the array of DM - attribute hashes @direct_messages .
results tallying subscribed and stopped zips
results tallying subscribed and stopped zips
Hash
example
DirectMessageReader.call => { :stopped => 13, :subscribed => 21 }
DirectMessageReader . call = > { : stopped = > 13 : subscribed = > 21 }