storage_room 0.3.13 → 0.3.14

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.14
2
+ * Fix deprecation warnings (class_inheritable_accessor)
3
+
1
4
  == Version 0.3.13
2
5
  * Added entry_type to Collection
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.14
@@ -5,5 +5,6 @@ APPLICATION_API_KEY = 'DZHpRbsJ7VgFXhybKWmT' # your application's API key with r
5
5
 
6
6
  StorageRoom.authenticate(ACCOUNT_ID, APPLICATION_API_KEY)
7
7
 
8
+ # Optionally set the server to a custom domain
8
9
  # StorageRoom.server = "api.lvh.me:3000"
9
10
  StorageRoom.server = "api.storageroomapp.com"
@@ -7,9 +7,6 @@ module StorageRoom
7
7
  included do
8
8
  self.send(:extend, ::ActiveModel::Callbacks)
9
9
  self.send(:define_model_callbacks, :initialize_from_response_data)
10
-
11
- self.class_inheritable_accessor :attribute_options
12
- self.attribute_options ||= {}
13
10
  end
14
11
 
15
12
  module InstanceMethods
@@ -109,7 +106,7 @@ module StorageRoom
109
106
  # Iterate over the response data and initialize the attributes
110
107
  def initialize_from_response_data # :nodoc:
111
108
  _run_initialize_from_response_data_callbacks do
112
- self.class.attribute_options.each do |name, options|
109
+ self.class.attribute_options_including_superclasses.each do |name, options|
113
110
  value = if options[:type] == :key
114
111
  self[name].blank? ? options[:default] : self[name]
115
112
  elsif options[:type] == :one
@@ -216,6 +213,17 @@ module StorageRoom
216
213
 
217
214
  self.attribute_options[name] = options
218
215
  end
216
+
217
+ def attribute_options
218
+ @attribute_options ||= {}
219
+ end
220
+
221
+ def attribute_options_including_superclasses
222
+ hash = attribute_options.dup
223
+ hash.merge!(superclass.attribute_options_including_superclasses) if superclass.respond_to?(:attribute_options_including_superclasses)
224
+
225
+ hash
226
+ end
219
227
  end
220
228
 
221
229
  end
@@ -1,6 +1,6 @@
1
1
  module StorageRoom
2
2
  class Entry < Model
3
- class_inheritable_accessor :collection
3
+ class_attribute :collection
4
4
 
5
5
  before_initialize_from_response_data :load_associated_collections
6
6
 
@@ -7,6 +7,19 @@ module StorageRoom
7
7
  key :test
8
8
  key :test2
9
9
  end
10
+
11
+ class TestAccessors2 < TestAccessors
12
+ key :test3
13
+ end
14
+
15
+ class TestAccessors3 < TestAccessors
16
+ key :test4
17
+ key :test5
18
+ end
19
+
20
+ class TestAccessors4 < TestAccessors3
21
+ key :test6
22
+ end
10
23
  end
11
24
 
12
25
  describe StorageRoom::TestAccessors do
@@ -35,6 +48,49 @@ describe StorageRoom::TestAccessors do
35
48
  StorageRoom::Resource.response_data_is_association?(hash).should be_false
36
49
  end
37
50
  end
51
+
52
+ describe "Inheritance" do
53
+ it "should have correct attribute_options hash" do
54
+ StorageRoom::TestAccessors.attribute_options.should have(2).items
55
+ StorageRoom::TestAccessors.attribute_options[:test].should be_present
56
+ StorageRoom::TestAccessors.attribute_options[:test2].should be_present
57
+
58
+ StorageRoom::TestAccessors.attribute_options_including_superclasses.should have(2).items
59
+ StorageRoom::TestAccessors.attribute_options_including_superclasses[:test].should be_present
60
+ StorageRoom::TestAccessors.attribute_options_including_superclasses[:test2].should be_present
61
+
62
+ #
63
+ StorageRoom::TestAccessors2.attribute_options.should have(1).item
64
+ StorageRoom::TestAccessors2.attribute_options[:test3].should be_present
65
+
66
+ StorageRoom::TestAccessors2.attribute_options_including_superclasses.should have(3).items
67
+ StorageRoom::TestAccessors2.attribute_options_including_superclasses[:test].should be_present
68
+ StorageRoom::TestAccessors2.attribute_options_including_superclasses[:test2].should be_present
69
+ StorageRoom::TestAccessors2.attribute_options_including_superclasses[:test3].should be_present
70
+
71
+ #
72
+ StorageRoom::TestAccessors3.attribute_options.should have(2).item
73
+ StorageRoom::TestAccessors3.attribute_options[:test4].should be_present
74
+ StorageRoom::TestAccessors3.attribute_options[:test5].should be_present
75
+
76
+ StorageRoom::TestAccessors3.attribute_options_including_superclasses.should have(4).items
77
+ StorageRoom::TestAccessors3.attribute_options_including_superclasses[:test].should be_present
78
+ StorageRoom::TestAccessors3.attribute_options_including_superclasses[:test2].should be_present
79
+ StorageRoom::TestAccessors3.attribute_options_including_superclasses[:test4].should be_present
80
+ StorageRoom::TestAccessors3.attribute_options_including_superclasses[:test5].should be_present
81
+
82
+ #
83
+ StorageRoom::TestAccessors4.attribute_options.should have(1).item
84
+ StorageRoom::TestAccessors4.attribute_options[:test6].should be_present
85
+
86
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses.should have(5).items
87
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses[:test].should be_present
88
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses[:test2].should be_present
89
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses[:test4].should be_present
90
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses[:test5].should be_present
91
+ StorageRoom::TestAccessors4.attribute_options_including_superclasses[:test6].should be_present
92
+ end
93
+ end
38
94
  end
39
95
 
40
96
 
@@ -7,7 +7,7 @@ describe StorageRoom::Field do
7
7
 
8
8
  context "Configuration" do
9
9
  it "should have keys" do
10
- keys = StorageRoom::Field.attribute_options.keys
10
+ keys = StorageRoom::Field.attribute_options_including_superclasses.keys
11
11
 
12
12
  [:name, :identifier, :interface, :hint, :input_type, :required, :unique, :maximum_length, :minimum_length, :minimum_number, :maximum_number, :minimum_size, :maximum_size].each do |key|
13
13
  keys.should include(key)
@@ -7,7 +7,7 @@ describe StorageRoom::AssociationField do
7
7
 
8
8
  context "Configuration" do
9
9
  it "should have keys" do
10
- keys = StorageRoom::AssociationField.attribute_options.keys
10
+ keys = StorageRoom::AssociationField.attribute_options_including_superclasses.keys
11
11
 
12
12
  [:collection_url].each do |key|
13
13
  keys.should include(key)
@@ -7,7 +7,7 @@ describe StorageRoom::AtomicField do
7
7
 
8
8
  context "Configuration" do
9
9
  it "should have keys" do
10
- keys = StorageRoom::AtomicField.attribute_options.keys
10
+ keys = StorageRoom::AtomicField.attribute_options_including_superclasses.keys
11
11
 
12
12
  [:default_value, :choices, :include_blank_choice].each do |key|
13
13
  keys.should include(key)
@@ -7,7 +7,7 @@ describe StorageRoom::Location do
7
7
 
8
8
  context "Configuration" do
9
9
  it "should have keys" do
10
- keys = StorageRoom::Location.attribute_options.keys
10
+ keys = StorageRoom::Location.attribute_options_including_superclasses.keys
11
11
 
12
12
  [:lat, :lng].each do |key|
13
13
  keys.should include(key)
@@ -1,5 +1,13 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
+ class TestEntry2 < StorageRoom::Entry
4
+ self.collection = 1
5
+ end
6
+
7
+ class TestEntry3 < StorageRoom::Entry
8
+ self.collection = 2
9
+ end
10
+
3
11
  describe StorageRoom::Entry do
4
12
  before(:each) do
5
13
  @string_field = StorageRoom::StringField.new(:name => 'Name', :identifier => 'name')
@@ -35,6 +43,14 @@ describe StorageRoom::Entry do
35
43
  end
36
44
  end
37
45
 
46
+ describe "#collection" do
47
+ it "should return correct collection for subclasses" do
48
+ @collection.entry_class.collection.should == @collection
49
+ TestEntry2.collection.should == 1
50
+ TestEntry3.collection.should == 2
51
+ end
52
+ end
53
+
38
54
  # describe "#search" do
39
55
  # it "should load" do
40
56
  # pending
data/storage_room.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{storage_room}
8
- s.version = "0.3.13"
7
+ s.name = "storage_room"
8
+ s.version = "0.3.14"
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-15}
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
- s.email = %q{sascha@thriventures.com}
12
+ s.date = "2011-11-21"
13
+ s.description = "StorageRoom is a CMS system for Mobile Applications (iPhone, Android, BlackBerry, ...). This library gives you an ActiveModel-like interface to your data."
14
+ s.email = "sascha@thriventures.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.rdoc",
@@ -123,13 +123,12 @@ Gem::Specification.new do |s|
123
123
  "storage_room.gemspec",
124
124
  "tasks/storage_room.rake"
125
125
  ]
126
- s.homepage = %q{http://github.com/thriventures/storage_room_gem}
126
+ s.homepage = "http://github.com/thriventures/storage_room_gem"
127
127
  s.require_paths = ["lib"]
128
- s.rubygems_version = %q{1.3.7}
129
- s.summary = %q{StorageRoom API Wrapper (ActiveModel style)}
128
+ s.rubygems_version = "1.8.10"
129
+ s.summary = "StorageRoom API Wrapper (ActiveModel style)"
130
130
 
131
131
  if s.respond_to? :specification_version then
132
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
133
132
  s.specification_version = 3
134
133
 
135
134
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storage_room
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 13
9
- version: 0.3.13
4
+ prerelease:
5
+ version: 0.3.14
10
6
  platform: ruby
11
7
  authors:
12
8
  - Sascha Konietzke
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-08-15 00:00:00 +02:00
18
- default_executable:
13
+ date: 2011-11-21 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rspec
@@ -25,10 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 2
31
- - 9
32
23
  version: 1.2.9
33
24
  type: :development
34
25
  version_requirements: *id001
@@ -40,8 +31,6 @@ dependencies:
40
31
  requirements:
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
34
  version: "0"
46
35
  type: :development
47
36
  version_requirements: *id002
@@ -53,10 +42,6 @@ dependencies:
53
42
  requirements:
54
43
  - - ">="
55
44
  - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- - 6
59
- - 1
60
45
  version: 0.6.1
61
46
  type: :runtime
62
47
  version_requirements: *id003
@@ -68,10 +53,6 @@ dependencies:
68
53
  requirements:
69
54
  - - ">="
70
55
  - !ruby/object:Gem::Version
71
- segments:
72
- - 3
73
- - 0
74
- - 0
75
56
  version: 3.0.0
76
57
  type: :runtime
77
58
  version_requirements: *id004
@@ -83,10 +64,6 @@ dependencies:
83
64
  requirements:
84
65
  - - ">="
85
66
  - !ruby/object:Gem::Version
86
- segments:
87
- - 3
88
- - 0
89
- - 0
90
67
  version: 3.0.0
91
68
  type: :runtime
92
69
  version_requirements: *id005
@@ -98,8 +75,6 @@ dependencies:
98
75
  requirements:
99
76
  - - ">="
100
77
  - !ruby/object:Gem::Version
101
- segments:
102
- - 0
103
78
  version: "0"
104
79
  type: :runtime
105
80
  version_requirements: *id006
@@ -218,7 +193,6 @@ files:
218
193
  - spec/storage_room_spec.rb
219
194
  - storage_room.gemspec
220
195
  - tasks/storage_room.rake
221
- has_rdoc: true
222
196
  homepage: http://github.com/thriventures/storage_room_gem
223
197
  licenses: []
224
198
 
@@ -232,21 +206,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
206
  requirements:
233
207
  - - ">="
234
208
  - !ruby/object:Gem::Version
235
- segments:
236
- - 0
237
209
  version: "0"
238
210
  required_rubygems_version: !ruby/object:Gem::Requirement
239
211
  none: false
240
212
  requirements:
241
213
  - - ">="
242
214
  - !ruby/object:Gem::Version
243
- segments:
244
- - 0
245
215
  version: "0"
246
216
  requirements: []
247
217
 
248
218
  rubyforge_project:
249
- rubygems_version: 1.3.7
219
+ rubygems_version: 1.8.10
250
220
  signing_key:
251
221
  specification_version: 3
252
222
  summary: StorageRoom API Wrapper (ActiveModel style)