dynameek 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynameek (0.2.2)
4
+ dynameek (0.3.1)
5
5
  aws-sdk
6
6
 
7
7
  GEM
@@ -11,6 +11,8 @@ module Dynameek
11
11
  value.to_s
12
12
  when :datetime
13
13
  Time.at(value).to_datetime
14
+ when :binary
15
+ Marshal.load(value)
14
16
  else
15
17
  value
16
18
  end
@@ -19,6 +21,8 @@ module Dynameek
19
21
  case type
20
22
  when :datetime
21
23
  value.to_time.to_f
24
+ when :binary
25
+ Marshal.dump(value)
22
26
  else
23
27
  value
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module Dynameek
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -4,10 +4,10 @@ class Simple
4
4
 
5
5
  field :my_id, :integer
6
6
  field :some_value, :string
7
-
7
+ field :binary_value, :binary
8
8
 
9
9
  hash_key :my_id
10
10
 
11
11
 
12
12
 
13
- end
13
+ end
@@ -8,6 +8,17 @@ describe Simple do
8
8
  simple = Simple.find(1)
9
9
  simple.delete if(!simple.nil?)
10
10
  end
11
+
12
+ it "should allow you to store binary data" do
13
+ con = nil
14
+ lambda{
15
+ con = Simple.create(:my_id => 1, :some_value => "hello", :binary_value => {:hello => :sup})
16
+ }.should_not raise_error
17
+ con.hash_key.should == 1
18
+ con.some_value.should == "hello"
19
+ con = Simple.find(1)
20
+ con.binary_value[:hello].should == :sup
21
+ end
11
22
  it "should allow you to create a new simple" do
12
23
  con = nil
13
24
  lambda{
@@ -23,4 +34,4 @@ describe Simple do
23
34
  con.some_value.should == "hello"
24
35
  end
25
36
 
26
- end
37
+ end
@@ -8,6 +8,7 @@ describe WithIndexTable do
8
8
  WithIndexTable.query([1, "google"]).delete
9
9
  end
10
10
 
11
+
11
12
  it "should allow you to create a new row" do
12
13
  con = nil
13
14
  lambda{
@@ -28,6 +29,36 @@ describe WithIndexTable do
28
29
  row1.hash_key.should == "1|google"
29
30
  row2.hash_key.should == "1|google"
30
31
  end
32
+
33
+ it "should store the correct dynameek index" do
34
+ time = DateTime.now
35
+ lambda{
36
+ row1 = WithIndexTable.create(:client_id => 1, :channel_id => "google",
37
+ :advert_id=> 1, :time => time)
38
+ row2 = WithIndexTable.create(:client_id => 1, :channel_id => "google",
39
+ :advert_id=> 2, :time => time)
40
+ row3 = WithIndexTable.create(:client_id => 2, :channel_id => "google",
41
+ :advert_id=> 2, :time => time)
42
+ }.should_not raise_error
43
+ res = WithIndexTable.index_table.items.query(
44
+ {hash_value: "1|google", range_value: time.to_time.to_f, select: :all}
45
+ )
46
+ res.first.attributes["current_range_val"].to_i.should == 2
47
+ res2 = WithIndexTable.index_table.items.query(
48
+ {hash_value: "2|google", range_value: time.to_time.to_f, select: :all}
49
+ )
50
+ res2.first.attributes["current_range_val"].to_i.should == 1
51
+ WithIndexTable.create(:client_id => 2, :channel_id => "google",
52
+ :advert_id=> 2, :time => time)
53
+
54
+ WithIndexTable.create(:client_id => 2, :channel_id => "google",
55
+ :advert_id=> 2, :time => time)
56
+
57
+ res3 = WithIndexTable.index_table.items.query(
58
+ {hash_value: "2|google", range_value: time.to_time.to_f, select: :all}
59
+ )
60
+ res3.first.attributes["current_range_val"].to_i.should == 3
61
+ end
31
62
 
32
63
  it "should allow you to query for the some hash and range" do
33
64
  row1, row2 = nil
@@ -44,4 +75,6 @@ describe WithIndexTable do
44
75
 
45
76
  end
46
77
 
78
+
79
+
47
80
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dynameek
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Max Dupenois
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-04-02 00:00:00 Z
13
+ date: 2013-04-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk