sinatra-rabbit 1.0.3 → 1.0.5

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.
@@ -124,6 +124,7 @@ module Sinatra
124
124
  current_collection = BaseCollection.collection_class(name, self)
125
125
  current_collection.set_base_class(self.base_class)
126
126
  current_collection.with_id!(opts.delete(:with_id)) if opts.has_key? :with_id
127
+ current_collection.no_member! if opts.has_key? :no_member
127
128
  current_collection.generate(name, self, &block)
128
129
  @collections << current_collection
129
130
  end
@@ -159,9 +160,13 @@ module Sinatra
159
160
  @with_id = ":#{id}"
160
161
  end
161
162
 
163
+ def self.no_member!
164
+ @no_member = true
165
+ end
166
+
162
167
  def self.path
163
- with_id_param = @with_id.nil? ? '' : ':id/'
164
- parent_routes + with_id_param + collection_name.to_s
168
+ with_id_param = @with_id.nil? ? '' : ':id' + (@no_member ? '' : '/')
169
+ parent_routes + with_id_param + ((@no_member) ? '' : collection_name.to_s)
165
170
  end
166
171
 
167
172
  def self.base_class;@klass;end
@@ -54,6 +54,16 @@ module Sinatra
54
54
  @params = block
55
55
  end
56
56
 
57
+ def params_array
58
+ @p_arr = []
59
+ instance_eval(&self.params)
60
+ @p_arr
61
+ end
62
+
63
+ def param(*args)
64
+ @p_arr << Rabbit::Param.new(*args)
65
+ end
66
+
57
67
  end
58
68
  end
59
69
 
@@ -78,7 +88,7 @@ module Sinatra
78
88
  end
79
89
 
80
90
  def self.included(base)
81
- base.register(Features)
91
+ base.register(Features) if base.respond_to? :register
82
92
  end
83
93
 
84
94
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  a simple REST API using easy to undestand DSL.
30
30
  EOF
31
31
 
32
- s.version = '1.0.3'
32
+ s.version = '1.0.5'
33
33
  s.date = Time.now
34
34
  s.summary = %q{Sinatra REST API DSL}
35
35
  s.files = FileList[
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-rabbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-12 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70288446299200 !ruby/object:Gem::Requirement
16
+ requirement: &70246636376260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70288446299200
24
+ version_requirements: *70246636376260
25
25
  description: ! " Rabbit is a Sinatra extension which can help you writing\n a
26
26
  simple REST API using easy to undestand DSL.\n"
27
27
  email: dev@deltacloud.apache.org