Module: Jack::Queues::Appcast

Defined in:
lib/jack/queues/appcast.rb

Instance Method Summary collapse

Instance Method Details

#connectionObject



5
6
7
# File 'lib/jack/queues/appcast.rb', line 5

def connection
  @connection ||= ::Appcast::Client.new(*connection_args)
end

#create(name_or_data, data = nil) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/jack/queues/appcast.rb', line 22

def create(name_or_data, data = nil)
  if data.nil?
    data         = name_or_data
    name_or_data = @queue_name
  end
  logger.info("[Appcast] Created message for #{name_or_data}")
  connection.create(name_or_data, data)
end

#delete(message) ⇒ Object



17
18
19
20
# File 'lib/jack/queues/appcast.rb', line 17

def delete(message)
  logger.info("[Appcast] Deleting message for #{message.name}")
  message.destroy
end

#messagesObject



9
10
11
12
13
14
15
# File 'lib/jack/queues/appcast.rb', line 9

def messages
  if @messages.nil?
    @messages = connection.list(@queue_name, @options)
    logger.info("[Appcast] Found #{@messages.size} message(s)")
  end
  @messages
end