lib/activehook/server/message.rb in activehook-server-0.1.5 vs lib/activehook/server/message.rb in activehook-server-0.1.6
- old
+ new
@@ -10,16 +10,16 @@
@errors = {}
end
def save
return false unless valid?
- save_hook
+ save_message
end
def save!
raise Errors::Message, 'Message is invalid' unless valid?
- save_hook
+ save_message
end
def payload=(payload)
if payload.is_a?(String)
@payload = JSON.parse(payload)
@@ -74,13 +74,13 @@
end
private
def save_message
- ActiveHook::Server.redis.with do |conn|
- @id = conn.incr('ah:total_queued')
- conn.lpush('ah:queue', to_json)
- conn.zadd('ah:validation', @id, @key)
+ Server.redis.with do |conn|
+ @id = conn.incr("#{Server.config.queue_namespace}:total")
+ conn.lpush(Server.config.queue_namespace, to_json)
+ conn.zadd("#{Server.config.queue_namespace}:validations", @id, @key)
end
end
def defaults
{ key: SecureRandom.uuid,