storage_room 0.3.12 → 0.3.13

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.13
2
+ * Added entry_type to Collection
3
+
1
4
  == Version 0.3.12
2
5
  * Reset Resource after reloading
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.12
1
+ 0.3.13
data/lib/storage_room.rb CHANGED
@@ -104,7 +104,7 @@ module StorageRoom
104
104
  end
105
105
 
106
106
  def entry_class_for_name(name) #:nodoc:
107
- self.entry_class_mappings[name] || name.gsub(/\s+/, "").classify
107
+ self.entry_class_mappings[name] || name
108
108
  end
109
109
 
110
110
  def version
@@ -2,6 +2,7 @@ module StorageRoom
2
2
  # A collection is used to define the structure of a data set.
3
3
  class Collection < Model
4
4
  key :name
5
+ key :entry_type
5
6
  key :primary_field_identifier
6
7
 
7
8
  many :fields
@@ -24,7 +25,7 @@ module StorageRoom
24
25
 
25
26
  # The class name of the collection's entries, can be overridden with a mapping
26
27
  def entry_class_name
27
- ensure_loaded { StorageRoom.entry_class_for_name(name)}
28
+ ensure_loaded { StorageRoom.entry_class_for_name(entry_type)}
28
29
  end
29
30
 
30
31
  # The class for the collection's entries
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "collection": {
3
3
  "name": "Guidebooks",
4
+ "entry_type": "Guidebook",
4
5
  "@updated_at": "2010-11-05T12:55:04Z",
5
6
  "@entries_url": "http://api.storageroomapp.com/accounts/4c8fd48542507175aa00002f/collections/4ddaf68b4d085d374a000003/entries",
6
7
  "@created_at": "2010-09-14T20:01:13Z",
@@ -4,6 +4,7 @@
4
4
  "@url": "http://api.storageroomapp.com/accounts/4c8fd48542507175aa00002f/collections",
5
5
  "resources": [{
6
6
  "name": "Guidebooks",
7
+ "entry_type": "Guidebook",
7
8
  "@updated_at": "2010-11-05T12:55:04Z",
8
9
  "@entries_url": "http://api.storageroomapp.com/accounts/4c8fd48542507175aa00002f/collections/4ddaf68b4d085d374a000003/entries",
9
10
  "@created_at": "2010-09-14T20:01:13Z",
@@ -8,6 +8,7 @@
8
8
  "@created_at": "2011-07-18T08:41:17Z",
9
9
  "@updated_at": "2011-07-18T08:41:17Z",
10
10
  "name": "Restaurants",
11
+ "entry_type": "Restaurant",
11
12
  "primary_field_identifier": null,
12
13
  "fields": [{
13
14
  "@type": "StringField",
@@ -6,7 +6,7 @@ end
6
6
  describe StorageRoom::Collection do
7
7
  before(:each) do
8
8
  @field = StorageRoom::StringField.new(:name => 'Name', :identifier => 'name')
9
- @collection = StorageRoom::Collection.new(:name => 'Restaurant', :fields => [@field])
9
+ @collection = StorageRoom::Collection.new(:name => 'Restaurant', :entry_type => 'Restaurant', :fields => [@field])
10
10
  @collection.response_data[:@version] = 1
11
11
  @collection.response_data[:@url] = "URL"
12
12
 
@@ -103,6 +103,7 @@ describe StorageRoom::Collection do
103
103
 
104
104
  it "should raise an error if class doesn't inherit from StorageRoom::Entry" do
105
105
  @collection.name = "RaiseError"
106
+ @collection.entry_type = "RaiseError"
106
107
  lambda {
107
108
  klass = @collection.entry_class
108
109
  }.should raise_error(RuntimeError)
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
3
  describe StorageRoom::Entry do
4
4
  before(:each) do
5
5
  @string_field = StorageRoom::StringField.new(:name => 'Name', :identifier => 'name')
6
- @collection = StorageRoom::Collection.new(:name => 'Report', :fields => [@string_field])
6
+ @collection = StorageRoom::Collection.new(:name => 'Report', :entry_type => 'Report', :fields => [@string_field])
7
7
  @collection.response_data[:@url] = '/collections/COLLECTION_ID'
8
8
  @collection.entry_class
9
9
  end
@@ -107,7 +107,7 @@ describe StorageRoom do
107
107
  end
108
108
 
109
109
  it "should return without mapping" do
110
- StorageRoom.entry_class_for_name('Restaurant Visits').should == 'RestaurantVisit'
110
+ StorageRoom.entry_class_for_name('RestaurantVisit').should == 'RestaurantVisit'
111
111
  end
112
112
  end
113
113
 
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.12"
8
+ s.version = "0.3.13"
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-08-10}
12
+ s.date = %q{2011-08-15}
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 = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 12
9
- version: 0.3.12
8
+ - 13
9
+ version: 0.3.13
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-08-10 00:00:00 +02:00
17
+ date: 2011-08-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency