storage_room 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == Version 0.3.7
2
+ * Added support for DeletedEntries
3
+
1
4
  == Version 0.3.6
2
5
  * Added methods to download files
3
6
  * Added example on how to download all files from an Export
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.6
1
+ 0.3.7
@@ -40,6 +40,11 @@ module StorageRoom
40
40
  end
41
41
  end
42
42
 
43
+ # Load all deleted entries of a collection
44
+ def deleted_entries
45
+ Array.load(self[:@deleted_entries_url])
46
+ end
47
+
43
48
  # The field with a specific identifier
44
49
  def field(identifier)
45
50
  ensure_loaded do
@@ -0,0 +1,19 @@
1
+ module StorageRoom
2
+ class DeletedEntry < Model
3
+ def collection_url
4
+ self[:@collection_url]
5
+ end
6
+
7
+ def entry_url
8
+ self[:@entry_url]
9
+ end
10
+
11
+ def entry_id
12
+ self[:@entry_url] ? self[:@entry_url].split('/').last : nil
13
+ end
14
+
15
+ def deleted_at
16
+ self[:@deleted_at]
17
+ end
18
+ end
19
+ end
data/lib/storage_room.rb CHANGED
@@ -32,6 +32,7 @@ module StorageRoom
32
32
 
33
33
  autoload :Collection, 'storage_room/models/collection'
34
34
  autoload :Entry, 'storage_room/models/entry'
35
+ autoload :DeletedEntry, 'storage_room/models/deleted_entry'
35
36
 
36
37
  autoload :Field, 'storage_room/embeddeds/field'
37
38
 
@@ -45,6 +45,14 @@ describe StorageRoom::Collection do
45
45
  end
46
46
  end
47
47
 
48
+ describe "#deleted_entries" do
49
+ it "should load" do
50
+ StorageRoom::Array.should_receive(:load)
51
+ @collection.deleted_entries
52
+ end
53
+
54
+ end
55
+
48
56
  describe "#entry_class_name" do
49
57
  it "should return string" do
50
58
  @collection.entry_class_name.should == 'Restaurant'
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe StorageRoom::DeletedEntry do
4
+
5
+
6
+ context "Instance" do
7
+ before(:each) do
8
+ @hash = {
9
+ '@type' => 'DeletedEntry',
10
+ '@url' => "http://api.storageroomapp.com/accounts/4e1e9c234250712eba000052/deleted_entries/4e269c0f42507106fc000001",
11
+ '@account_url' => "http://api.storageroomapp.com/accounts/4e1e9c234250712eba000052",
12
+ '@collection_url' => "http://api.storageroomapp.com/accounts/4e1e9c234250712eba000052/collections/4e1e9c234250712eba000056",
13
+ '@entry_url' => "http://api.storageroomapp.com/accounts/4e1e9c234250712eba000052/collections/4e1e9c234250712eba000056/entries/4e269c2742507106fc000004",
14
+ '@deleted_at' => "2011-07-20T09:13:13Z"
15
+ }
16
+ @deleted_entry = StorageRoom::Resource.new_from_response_data(@hash)
17
+ end
18
+
19
+ describe "#entry_url" do
20
+ it "should return url" do
21
+ @deleted_entry.entry_url.should == @hash['@entry_url']
22
+ end
23
+ end
24
+
25
+ describe "#entry_id" do
26
+ it "should return id" do
27
+ @deleted_entry.entry_id.should == '4e269c2742507106fc000004'
28
+ end
29
+ end
30
+
31
+ describe "#collection_url" do
32
+ it "should return url" do
33
+ @deleted_entry.collection_url.should == @hash['@collection_url']
34
+ end
35
+ end
36
+
37
+ describe "#deleted_at" do
38
+ it "should return date" do
39
+ @deleted_entry.deleted_at.should be_present
40
+ end
41
+ end
42
+
43
+ end
44
+ end
data/storage_room.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{storage_room}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sascha Konietzke"]
12
- s.date = %q{2011-07-19}
12
+ s.date = %q{2011-07-21}
13
13
  s.description = %q{StorageRoom is a CMS system for Mobile Applications (iPhone, Android, BlackBerry, ...). This library gives you an ActiveModel-like interface to your data.}
14
14
  s.email = %q{sascha@thriventures.com}
15
15
  s.extra_rdoc_files = [
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
66
66
  "lib/storage_room/identity_map.rb",
67
67
  "lib/storage_room/model.rb",
68
68
  "lib/storage_room/models/collection.rb",
69
+ "lib/storage_room/models/deleted_entry.rb",
69
70
  "lib/storage_room/models/entry.rb",
70
71
  "lib/storage_room/plugins.rb",
71
72
  "lib/storage_room/proxy.rb",
@@ -108,6 +109,7 @@ Gem::Specification.new do |s|
108
109
  "spec/storage_room/identity_map_spec.rb",
109
110
  "spec/storage_room/model_spec.rb",
110
111
  "spec/storage_room/models/collection_spec.rb",
112
+ "spec/storage_room/models/deleted_entry_spec.rb",
111
113
  "spec/storage_room/models/entry_spec.rb",
112
114
  "spec/storage_room/proxy_spec.rb",
113
115
  "spec/storage_room/resource_spec.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sascha Konietzke
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-19 00:00:00 +02:00
17
+ date: 2011-07-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -147,6 +147,7 @@ files:
147
147
  - lib/storage_room/identity_map.rb
148
148
  - lib/storage_room/model.rb
149
149
  - lib/storage_room/models/collection.rb
150
+ - lib/storage_room/models/deleted_entry.rb
150
151
  - lib/storage_room/models/entry.rb
151
152
  - lib/storage_room/plugins.rb
152
153
  - lib/storage_room/proxy.rb
@@ -189,6 +190,7 @@ files:
189
190
  - spec/storage_room/identity_map_spec.rb
190
191
  - spec/storage_room/model_spec.rb
191
192
  - spec/storage_room/models/collection_spec.rb
193
+ - spec/storage_room/models/deleted_entry_spec.rb
192
194
  - spec/storage_room/models/entry_spec.rb
193
195
  - spec/storage_room/proxy_spec.rb
194
196
  - spec/storage_room/resource_spec.rb