Sha256: 85cad631c9bd9bfc6e0760b89076b960363b801f9026e4fcf4b4a8f22b62770b
Contents?: true
Size: 904 Bytes
Versions: 5
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true require 'mail' require 'erb' require 'tilt' require 'gov_fake_notify/store' module GovFakeNotify # A service used to fetch all message statuses class FetchAllMessagesStatusCommand attr_reader :errors def self.call(params, **kwargs) new(params, **kwargs).call end def initialize(params, store: Store.instance) @params = params @store = store @errors = [] @messages = [] end def call message_keys = store.transaction { store.roots.select { |k| k =~ /^message-/ } } @messages = store.transaction { message_keys.map { |key| store.fetch(key) } } self end def success? errors.empty? end def to_json # We do not support links yet JSON.pretty_generate(notifications: messages, links: []) end private attr_reader :params, :store, :messages end end
Version data entries
5 entries across 5 versions & 1 rubygems