Sha256: 2d9cf732546ff47d3d2f640aa2af236c0db21eae57a671abc629272e98806c53
Contents?: true
Size: 767 Bytes
Versions: 3
Compression:
Stored size: 767 Bytes
Contents
require 'json' module MixpanelMagicLamp class Queue < Array def push(request, opts = {}) item = { request: request, format: opts.delete(:format), status: nil, response: nil, data: nil } self << item and return item end def process! self.each do |request| next unless request[:status].nil? request[:status] = request[:request].response.code if request[:request].response.success? formatter = MixpanelMagicLamp::Formatter.new(request[:request]) request[:data] = formatter.convert format: request[:format] else request[:response] = JSON.parse(request[:request].response.body) end end self end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mixpanel_magic_lamp-1.0.3 | lib/mixpanel_magic_lamp/queue.rb |
mixpanel_magic_lamp-1.0.1 | lib/mixpanel_magic_lamp/queue.rb |
mixpanel_magic_lamp-1.0.0 | lib/mixpanel_magic_lamp/queue.rb |