storage_room 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == Version 0.3.9
2
+ * Added a check that already defined classes inherit from StorageRoom::Entry
3
+
1
4
  == Version 0.3.8
2
5
  * Added symbol operator and array parameters
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.8
1
+ 0.3.9
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby -rubygems
2
+
3
+ require File.join(File.dirname(__FILE__), 'authentication')
4
+
5
+ guidebook_collection = StorageRoom::Collection.find('4e1e9c234250712eba00005f')
6
+
7
+ guidebook_collection.entries.resources.each do |guidebook|
8
+ puts "#{guidebook.title} (#{guidebook.category.try(:name)})"
9
+ end
@@ -1,8 +1,9 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'lib', 'storage_room')
2
2
 
3
- ACCOUNT_ID = '4dda7761b65245fde1000051' # your account id
4
- APPLICATION_API_KEY = 'kCWTmS1wxYnxzJyteuIn' # your application's API key with read/write access
3
+ ACCOUNT_ID = '4e1e9c234250712eba000052' # your account id
4
+ APPLICATION_API_KEY = 'fgK8Di4FYuRKtk2Xd12A' # your application's API key with read/write access
5
5
 
6
6
  StorageRoom.authenticate(ACCOUNT_ID, APPLICATION_API_KEY)
7
7
 
8
- StorageRoom.server = "api.lvh.me:3000"
8
+ StorageRoom.server = "api.lvh.me:3000"
9
+ # StorageRoom.server = "api.storageroomapp.com"
@@ -64,9 +64,9 @@ module StorageRoom
64
64
 
65
65
  def initialize_entry_class
66
66
  name = self.entry_class_name
67
-
67
+
68
68
  klass = if Object.is_constant_defined?(name.to_sym)
69
- name.constantize
69
+ name.constantize.tap{|k| raise "Class '#{name}' must inherit from StorageRoom::Entry" unless k.ancestors.include?(Entry)}
70
70
  else
71
71
  klass = Class.new(Entry)
72
72
  Object.const_set(name, klass)
@@ -1,5 +1,8 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
+ class RaiseError
4
+ end
5
+
3
6
  describe StorageRoom::Collection do
4
7
  before(:each) do
5
8
  @field = StorageRoom::StringField.new(:name => 'Name', :identifier => 'name')
@@ -98,6 +101,13 @@ describe StorageRoom::Collection do
98
101
  guidebook.name.should == 'NAME'
99
102
  end
100
103
 
104
+ it "should raise an error if class doesn't inherit from StorageRoom::Entry" do
105
+ @collection.name = "RaiseError"
106
+ lambda {
107
+ klass = @collection.entry_class
108
+ }.should raise_error(RuntimeError)
109
+ end
110
+
101
111
  end
102
112
 
103
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.8"
8
+ s.version = "0.3.9"
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-25}
12
+ s.date = %q{2011-07-29}
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 = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "TODO",
26
26
  "VERSION",
27
+ "examples/associations.rb",
27
28
  "examples/authentication.rb",
28
29
  "examples/backup_uploads_from_export.rb",
29
30
  "examples/create_entry.rb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 8
9
- version: 0.3.8
8
+ - 9
9
+ version: 0.3.9
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-25 00:00:00 +02:00
17
+ date: 2011-07-29 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -105,6 +105,7 @@ files:
105
105
  - Rakefile
106
106
  - TODO
107
107
  - VERSION
108
+ - examples/associations.rb
108
109
  - examples/authentication.rb
109
110
  - examples/backup_uploads_from_export.rb
110
111
  - examples/create_entry.rb