alephant-publisher 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 987e64cc1358a5b0e29774c6333eb85a6b8785c2
4
- data.tar.gz: bf8fc99bd80b93bfb4b13aef60e13fc5817485f5
3
+ metadata.gz: d93ee0d2aabcb7e27db2aba8fd4c957663e06ffb
4
+ data.tar.gz: 5c2b5aa224c8c762c97b046046d04c9dc4e81add
5
5
  SHA512:
6
- metadata.gz: d1b13b27fbb64da5c8009d98121de59138f3c7c99f0f3a9b3af8402db168825c5acf886925938f8d79624fbb6e3e527e5fa3aaef6d0a6a80f4f6aa36230e0743
7
- data.tar.gz: cc914584dc1f4621964c3f3a6485901f60bdfd459aee7495cf3c6f3dd8f95ff4b3a05c2b3040086af702ba5676c058576f1ac82e8b4ed65e012d56c3656dbb51
6
+ metadata.gz: e5c98f4c69a8bc5a88ffdaaf7f0c413b57547e2467dfcbdd791b68b371469f5e51bd254232a11fe842252f71ad6833c5ab20376831b649eb995037f35abc2e4e
7
+ data.tar.gz: 394ef826ee1ee022e219f2117d5f7c2ea79f52273ed6b380fbb630cf9ed419fe8adff87ce5227cd20548f08fd01a6d3b114f9b1b9556dc7bf7908e7559e4ff84
@@ -1,3 +1,5 @@
1
+ require 'date'
2
+
1
3
  module Alephant
2
4
  module Publisher
3
5
  module SQSHelper
@@ -21,14 +23,18 @@ module Alephant
21
23
  end
22
24
 
23
25
  def store(m)
24
- cache.put("archive/#{m.id}", m.body, meta_for(m))
26
+ cache.put("archive/#{date_key}/#{m.id}", m.body, meta_for(m))
27
+ end
28
+
29
+ def date_key
30
+ DateTime.now.strftime('%d-%m-%Y_%H')
25
31
  end
26
32
 
27
33
  def meta_for(m)
28
34
  {
29
35
  :id => m.id,
30
36
  :md5 => m.md5,
31
- :logged_at => Time.now.to_s,
37
+ :logged_at => DateTime.now.to_s,
32
38
  :queue => m.queue.url,
33
39
  }
34
40
  end
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Publisher
3
- VERSION = "0.2.9"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Alephant::Publisher::SQSHelper::Archiver do
4
4
  describe "#see" do
5
5
  it "calls cache put with the correct params" do
6
- time_now = Time.parse("Feb 24 1981")
7
- Time.stub!(:now).and_return(time_now)
6
+ time_now = DateTime.parse("Feb 24 1981")
7
+ DateTime.stub(:now).and_return(time_now)
8
8
 
9
9
  q = double("queue").as_null_object
10
10
  c = double("cache").as_null_object
@@ -14,7 +14,7 @@ describe Alephant::Publisher::SQSHelper::Archiver do
14
14
  m = Struct.new(:id, :body, :md5, :queue).new('id', 'body', 'md5', q)
15
15
 
16
16
  expect(c).to receive(:put).with(
17
- "archive/id",
17
+ "archive/#{time_now.strftime('%d-%m-%Y_%H')}/id",
18
18
  "body",
19
19
  {
20
20
  :id => "id",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Integralist