arrest 0.0.27 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/arrest/abstract_resource.rb +3 -3
- data/lib/arrest/root_resource.rb +4 -4
- data/lib/arrest/version.rb +1 -1
- metadata +97 -158
@@ -3,7 +3,7 @@ require 'arrest/string_utils'
|
|
3
3
|
require 'time'
|
4
4
|
require 'active_model'
|
5
5
|
|
6
|
-
Scope = Struct.new(:name, :block)
|
6
|
+
Scope = Struct.new(:name, :options, :block)
|
7
7
|
|
8
8
|
module Arrest
|
9
9
|
|
@@ -211,11 +211,11 @@ module Arrest
|
|
211
211
|
end
|
212
212
|
|
213
213
|
|
214
|
-
def scope(name, &block)
|
214
|
+
def scope(name, options = {}, &block)
|
215
215
|
if @scopes == nil
|
216
216
|
@scopes = []
|
217
217
|
end
|
218
|
-
@scopes << Scope.new(name, &block)
|
218
|
+
@scopes << Scope.new(name, options, &block)
|
219
219
|
end
|
220
220
|
|
221
221
|
|
data/lib/arrest/root_resource.rb
CHANGED
@@ -89,16 +89,16 @@ module Arrest
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
super(name)
|
92
|
+
def scope name, options = {}, &block
|
93
|
+
super(name, options)
|
95
94
|
if block_given?
|
96
95
|
send :define_singleton_method, name do |context|
|
97
96
|
self.all(context).select(&block)
|
98
97
|
end
|
99
98
|
else
|
100
99
|
send :define_singleton_method, name do |context|
|
101
|
-
|
100
|
+
resource_name = options[:resource_name] || name
|
101
|
+
body_root(source().get_many(context, self.scoped_path(resource_name))).map do |h|
|
102
102
|
self.build(context, h)
|
103
103
|
end
|
104
104
|
end
|
data/lib/arrest/version.rb
CHANGED
metadata
CHANGED
@@ -1,176 +1,133 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: arrest
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.28
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 27
|
10
|
-
version: 0.0.27
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Axel Tetzlaff
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-17 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: json
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &11347700 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: faraday
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *11347700
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: faraday
|
27
|
+
requirement: &11346820 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 9
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
- 7
|
46
|
-
- 5
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
47
32
|
version: 0.7.5
|
48
33
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: activemodel
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *11346820
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activemodel
|
38
|
+
requirement: &11345540 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
40
|
+
requirements:
|
56
41
|
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 3
|
61
|
-
version: "3"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3'
|
62
44
|
type: :runtime
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: bundler
|
66
45
|
prerelease: false
|
67
|
-
|
46
|
+
version_requirements: *11345540
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: &11344440 !ruby/object:Gem::Requirement
|
68
50
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 23
|
73
|
-
segments:
|
74
|
-
- 1
|
75
|
-
- 0
|
76
|
-
- 0
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
77
54
|
version: 1.0.0
|
78
55
|
type: :development
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: rake
|
82
56
|
prerelease: false
|
83
|
-
|
57
|
+
version_requirements: *11344440
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &11343060 !ruby/object:Gem::Requirement
|
84
61
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
92
66
|
type: :development
|
93
|
-
version_requirements: *id005
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rdoc
|
96
67
|
prerelease: false
|
97
|
-
|
68
|
+
version_requirements: *11343060
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
71
|
+
requirement: &11340880 !ruby/object:Gem::Requirement
|
98
72
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
106
77
|
type: :development
|
107
|
-
version_requirements: *id006
|
108
|
-
- !ruby/object:Gem::Dependency
|
109
|
-
name: rspec
|
110
78
|
prerelease: false
|
111
|
-
|
79
|
+
version_requirements: *11340880
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: &11336200 !ruby/object:Gem::Requirement
|
112
83
|
none: false
|
113
|
-
requirements:
|
84
|
+
requirements:
|
114
85
|
- - ~>
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
|
117
|
-
segments:
|
118
|
-
- 2
|
119
|
-
version: "2"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2'
|
120
88
|
type: :development
|
121
|
-
version_requirements: *id007
|
122
|
-
- !ruby/object:Gem::Dependency
|
123
|
-
name: rr
|
124
89
|
prerelease: false
|
125
|
-
|
90
|
+
version_requirements: *11336200
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rr
|
93
|
+
requirement: &11335100 !ruby/object:Gem::Requirement
|
126
94
|
none: false
|
127
|
-
requirements:
|
128
|
-
- -
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
version: "0"
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
134
99
|
type: :development
|
135
|
-
version_requirements: *id008
|
136
|
-
- !ruby/object:Gem::Dependency
|
137
|
-
name: simplecov
|
138
100
|
prerelease: false
|
139
|
-
|
101
|
+
version_requirements: *11335100
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &11334060 !ruby/object:Gem::Requirement
|
140
105
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
|
145
|
-
segments:
|
146
|
-
- 0
|
147
|
-
version: "0"
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
148
110
|
type: :development
|
149
|
-
version_requirements: *id009
|
150
|
-
- !ruby/object:Gem::Dependency
|
151
|
-
name: rack
|
152
111
|
prerelease: false
|
153
|
-
|
112
|
+
version_requirements: *11334060
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rack
|
115
|
+
requirement: &11332720 !ruby/object:Gem::Requirement
|
154
116
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
version: "0"
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
162
121
|
type: :development
|
163
|
-
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *11332720
|
164
124
|
description: Consume a rest API in a AR like fashion
|
165
|
-
email:
|
125
|
+
email:
|
166
126
|
- axel.tetzlaff@fortytools.com
|
167
127
|
executables: []
|
168
|
-
|
169
128
|
extensions: []
|
170
|
-
|
171
129
|
extra_rdoc_files: []
|
172
|
-
|
173
|
-
files:
|
130
|
+
files:
|
174
131
|
- .gitignore
|
175
132
|
- .rspec
|
176
133
|
- Gemfile
|
@@ -212,46 +169,28 @@ files:
|
|
212
169
|
- test/nested_resource.rb
|
213
170
|
- test/unit.rb
|
214
171
|
- test/validations.rb
|
215
|
-
homepage:
|
172
|
+
homepage: ''
|
216
173
|
licenses: []
|
217
|
-
|
218
174
|
post_install_message:
|
219
175
|
rdoc_options: []
|
220
|
-
|
221
|
-
require_paths:
|
176
|
+
require_paths:
|
222
177
|
- lib
|
223
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
224
179
|
none: false
|
225
|
-
requirements:
|
226
|
-
- -
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
|
229
|
-
|
230
|
-
- 0
|
231
|
-
version: "0"
|
232
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ! '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
185
|
none: false
|
234
|
-
requirements:
|
235
|
-
- -
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
|
238
|
-
segments:
|
239
|
-
- 0
|
240
|
-
version: "0"
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
241
190
|
requirements: []
|
242
|
-
|
243
191
|
rubyforge_project: arrest
|
244
192
|
rubygems_version: 1.8.10
|
245
193
|
signing_key:
|
246
194
|
specification_version: 3
|
247
195
|
summary: Another ruby rest client
|
248
|
-
test_files:
|
249
|
-
- spec/arrest_spec.rb
|
250
|
-
- spec/spec_helper.rb
|
251
|
-
- spec/support/models/user.rb
|
252
|
-
- test/context.rb
|
253
|
-
- test/has_attributed.rb
|
254
|
-
- test/models.rb
|
255
|
-
- test/nested_resource.rb
|
256
|
-
- test/unit.rb
|
257
|
-
- test/validations.rb
|
196
|
+
test_files: []
|