reviewed 0.1.28 → 0.1.29

Sign up to get free protection for your applications and to get access to all the features.
data/lib/reviewed/base.rb CHANGED
@@ -12,6 +12,22 @@ module Reviewed
12
12
  self.attributes = objectify(data)
13
13
  end
14
14
 
15
+ def created_at
16
+ if @attributes.has_key?(:created_at)
17
+ Time.parse(@attributes[:created_at])
18
+ else
19
+ nil
20
+ end
21
+ end
22
+
23
+ def updated_at
24
+ if @attributes.has_key?(:updated_at)
25
+ Time.parse(@attributes[:updated_at])
26
+ else
27
+ nil
28
+ end
29
+ end
30
+
15
31
  class << self
16
32
 
17
33
  def path
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "0.1.28"
2
+ VERSION = "0.1.29"
3
3
  API_VERSION = 'v1'
4
4
  end
data/spec/base_spec.rb CHANGED
@@ -41,9 +41,21 @@ describe Reviewed::Base do
41
41
  end
42
42
 
43
43
  describe 'attributes' do
44
+ before(:each) do
45
+ @timestamp = Time.parse("01/01/2013 10:00:00 GMT")
46
+ @model = Example.new(id: 'id', super_awesome: 'true', created_at: @timestamp.to_s, updated_at: @timestamp.to_s)
47
+ end
48
+
44
49
  it 'returns the named attribute (via method missing)' do
45
- model = Example.new(id: 'id', super_awesome: 'true')
46
- model.super_awesome.should == 'true'
50
+ @model.super_awesome.should == 'true'
51
+ end
52
+
53
+ it 'has a created at timestamp' do
54
+ @model.created_at.should == @timestamp
55
+ end
56
+
57
+ it 'has an updated at timestamp' do
58
+ @model.updated_at.should == @timestamp
47
59
  end
48
60
  end
49
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.29
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: