grape-transformations 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0671afb517a8ce6d8dae407d88c912f008a15f01
4
- data.tar.gz: 6911ef6f1f38de48d2879b4f162acbcfea151217
3
+ metadata.gz: 71e0b759ccf6069432ae0a86962dee468e0cb2d7
4
+ data.tar.gz: 54c0e6a3cb36152cd0051fc8017972ccbe41a5ad
5
5
  SHA512:
6
- metadata.gz: f46e9e53f6c05f33b720b53d50dafdaede2d454ef73a07bccb603b69fcaa732971b597f0ea5f3fd814ee9ae2bfb74c9c19c3d7d27be09cb27856a8a449c84ebd
7
- data.tar.gz: 8ee78295cbca8d05726947c0cd00df809da0473921be6bc0de712cd5e43aeab0a490cb51ea1e71525ddc6a2b696f8f5ed64acc238c238ae1730996c1de2d55be
6
+ metadata.gz: 86c6bc18e89ab66ffe372f7d68d77e9d735ad7cb92429564a6ba02616756ca6925d64def49b877174032a559edeab64f5317b68bae6cd5172c1854acd980c689
7
+ data.tar.gz: bd04c42c432d69ab036b5405633033128717f28f9f110b2b8c1a64d3329b53535b89a91eef3d8d778309c5475db532b41c8e3ffb1703badd2457eea040a689a5
@@ -1,10 +1,10 @@
1
1
  module <%= app_name.classify %>
2
2
  module Entities
3
3
  module <%= entity_name.classify.pluralize %>
4
- class Default < Grape::Entity
5
- <% fields.each do |field| %>
4
+ class <%= class_name %> < Grape::Entity
5
+ <% fields.to_a.each do |field| %>
6
6
  <% attribute, type = field.split(':')%>
7
- expose :<%= attribute %>, documentation: { type: '<%= type %>', desc: 'write a description here', example: 'write an example here' }
7
+ expose :<%= attribute %>, documentation: { type: '<%= type %>', desc: '', example: '' }
8
8
  <% end %>
9
9
  end
10
10
  end
@@ -0,0 +1,17 @@
1
+ module <%= app_name.classify %>
2
+ module Modules
3
+ class <%= underscored_module_name.classify %> < Grape::API
4
+ include Grape::Transformations::Base
5
+ target_model <%= "::#{target_model}" %>
6
+ helpers do
7
+ # Write your helpers here
8
+ end
9
+ define_endpoints do |entity|
10
+ # Write your single endpoints here
11
+ end
12
+ resource <%= ":#{underscored_module_name}" %> do
13
+ add_endpoints
14
+ end
15
+ end
16
+ end
17
+ end
@@ -26,12 +26,12 @@ module Grape
26
26
 
27
27
  source_root File.expand_path('../../templates', __FILE__)
28
28
 
29
- argument :entity_name, type: :string, required: true, desc: 'name of entity'
29
+ argument :composed_entity_name, type: :string, required: true, desc: 'name of entity'
30
30
  argument :fields, :type => :array, required: false, desc: 'field set that you want to expose'
31
31
 
32
32
  def generate_layout
33
33
  @fields ||= []
34
- template "entity.rb", "app/api/#{app_name}/entities/#{underscored_entity_name.pluralize}/default.rb"
34
+ template "entity.rb", "app/api/#{app_name}/entities/#{underscored_entity_name.pluralize}/#{class_name.underscore}.rb"
35
35
  end
36
36
 
37
37
  private
@@ -42,8 +42,24 @@ module Grape
42
42
  Rails.application.config.session_options[:key].sub(/^_/,'').sub(/_session/,'')
43
43
  end
44
44
 
45
+ def class_name
46
+ underscored_transformation_name.nil? ? 'Default' : underscored_transformation_name.classify
47
+ end
48
+
49
+ def entity_name
50
+ composed_entity_name.split(':').first
51
+ end
52
+
53
+ def transformation_name
54
+ composed_entity_name.split(':').second
55
+ end
56
+
45
57
  def underscored_entity_name
46
- entity_name.underscore
58
+ entity_name.underscore unless entity_name.nil?
59
+ end
60
+
61
+ def underscored_transformation_name
62
+ transformation_name.underscore unless transformation_name.nil?
47
63
  end
48
64
 
49
65
  end
@@ -0,0 +1,64 @@
1
+ module Grape
2
+ module Generators
3
+ module Transformations
4
+ class ModuleGenerator < ::Rails::Generators::Base
5
+
6
+ desc <<-DESC
7
+ Create inherited Grape::API class in your app/api/.../modules folder. this
8
+ created class will have related with grape-transformations naming conventions
9
+
10
+ For example:
11
+
12
+ rails generate module user
13
+
14
+ This will create a entity class at app/api/.../entities/users/default.rb like this:
15
+
16
+ module TestApp
17
+ module Modules
18
+ class User < Grape::API
19
+ include Grape::Transformations::Base
20
+ target_model ::User
21
+ helpers do
22
+ # Write your helpers here
23
+ end
24
+ define_endpoints do |entity|
25
+ # Write your single endpoints here
26
+ end
27
+ resource :users do
28
+ add_endpoints
29
+ end
30
+ end
31
+ end
32
+ end
33
+ DESC
34
+
35
+ source_root File.expand_path('../../templates', __FILE__)
36
+
37
+ argument :module_name, type: :string, required: true, desc: 'name of module'
38
+ argument :raw_target_model, :type => :string, required: false, desc: 'name of target model'
39
+
40
+ def generate_layout
41
+ @fields ||= []
42
+ template "module.rb", "app/api/#{app_name}/modules/#{underscored_module_name}.rb"
43
+ end
44
+
45
+ private
46
+
47
+ # Returns the app name
48
+ # @return [String]
49
+ def app_name
50
+ Rails.application.config.session_options[:key].sub(/^_/,'').sub(/_session/,'')
51
+ end
52
+
53
+ def underscored_module_name
54
+ module_name.underscore unless module_name.nil?
55
+ end
56
+
57
+ def target_model
58
+ raw_target_model.nil? ? underscored_module_name.classify : raw_target_model.classify
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Transformations
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ require 'grape/transformations/base'
4
4
  require 'rails/generators'
5
5
  require 'grape/generators/transformations/entity_generator'
6
6
  require 'grape/generators/transformations/install_generator'
7
+ require 'grape/generators/transformations/module_generator'
7
8
  require 'grape/transformations/engine' if defined?(Rails)
8
9
  require 'grape'
9
10
  require 'rails'
@@ -6,7 +6,7 @@ describe 'User Endpoint', :type => :request do
6
6
  let(:second_user) { User.new name: 'Elva Lasso', age: 25, birthday: Date.parse('15-06-1989'), phone: '777-5555', address: 'Fake st. 1-25' }
7
7
 
8
8
  context 'GET' do
9
- describe 'default transformation' do
9
+ describe 'All Users' do
10
10
  before(:each){ allow(::User).to receive(:all) { [first_user, second_user] } }
11
11
  describe '/' do
12
12
  it 'gets all users with default transformation' do
@@ -27,7 +27,7 @@ describe 'User Endpoint', :type => :request do
27
27
  end
28
28
  end
29
29
  end
30
- describe 'compact transformation' do
30
+ describe 'User by ID' do
31
31
  before(:each){ allow(::User).to receive(:find) { first_user } }
32
32
  describe '/:id' do
33
33
  it 'gets specific user with default transformation' do
@@ -10,13 +10,30 @@ describe Grape::Generators::Transformations::EntityGenerator, :type => :generato
10
10
 
11
11
  context 'entity generating process' do
12
12
 
13
- describe 'simple entity' do
13
+ describe 'default entity' do
14
14
 
15
- before(:each){ run_generator %w(user) }
15
+ before(:each){ run_generator %w(user name:string email:string age:integer) }
16
16
 
17
17
  subject { file 'app/api/test_app/entities/users/default.rb' }
18
18
 
19
19
  it { should exist }
20
+ it { should contain /class Default < Grape::Entity/ }
21
+ it { should contain /expose :name, documentation: { type: 'string', desc: '', example: '' }/ }
22
+ it { should contain /expose :email, documentation: { type: 'string', desc: '', example: '' }/ }
23
+ it { should contain /expose :age, documentation: { type: 'integer', desc: '', example: '' }/ }
24
+
25
+ end
26
+
27
+ describe 'compact entity' do
28
+
29
+ before(:each){ run_generator %w(user:compact name:string email:string) }
30
+
31
+ subject { file 'app/api/test_app/entities/users/compact.rb' }
32
+
33
+ it { should exist }
34
+ it { should contain /class Compact < Grape::Entity/ }
35
+ it { should contain /expose :name, documentation: { type: 'string', desc: '', example: '' }/ }
36
+ it { should contain /expose :email, documentation: { type: 'string', desc: '', example: '' }/ }
20
37
 
21
38
  end
22
39
 
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ require 'grape/generators/transformations/module_generator'
4
+
5
+ describe Grape::Generators::Transformations::ModuleGenerator, :type => :generator do
6
+
7
+ destination File.expand_path('../../../tmp/tests', __FILE__)
8
+
9
+ before { prepare_destination }
10
+
11
+ context 'module generating process' do
12
+
13
+ describe 'default entity' do
14
+
15
+ before(:each){ run_generator %w(user) }
16
+
17
+ subject { file 'app/api/test_app/modules/user.rb' }
18
+
19
+ it { should exist }
20
+ it { should contain /class User < Grape::API/ }
21
+ it { should contain /include Grape::Transformations::Base/ }
22
+ it { should contain /target_model ::User/ }
23
+ it { should contain /define_endpoints do \|entity\|/ }
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
data/spec/spec_helper.rb CHANGED
@@ -46,7 +46,7 @@ RSpec.configure do |config|
46
46
 
47
47
  config.after(:suite) do
48
48
  # Removes the tests directory used for generators testing
49
- File.join File.expand_path("../", __FILE__), "/tmp/tests"
49
+ File.join File.expand_path("../", __FILE__), "/tmp/tests"
50
50
  end
51
51
 
52
52
  config.include RSpec::Rails::RequestExampleGroup, type: :request, parent_example_group: { file_path: /spec\/api/ }
@@ -142,3 +142,457 @@ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-19 15:46:13 -0500
142
142
 
143
143
 
144
144
  Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-19 15:46:13 -0500
145
+
146
+
147
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:44:33 -0500
148
+
149
+
150
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:44:34 -0500
151
+
152
+
153
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:44:34 -0500
154
+
155
+ ArgumentError (wrong number of arguments (1 for 0)):
156
+ app/api/test_app/modules/user.rb:19:in `block (2 levels) in <class:User>'
157
+
158
+
159
+
160
+
161
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:44:34 -0500
162
+
163
+ ArgumentError (wrong number of arguments (1 for 0)):
164
+ app/api/test_app/modules/user.rb:19:in `block (2 levels) in <class:User>'
165
+
166
+
167
+
168
+
169
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:44:34 -0500
170
+
171
+ ArgumentError (wrong number of arguments (1 for 0)):
172
+ app/api/test_app/modules/user.rb:27:in `block (2 levels) in <class:User>'
173
+
174
+
175
+
176
+
177
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:44:34 -0500
178
+
179
+ ArgumentError (wrong number of arguments (1 for 0)):
180
+ app/api/test_app/modules/user.rb:27:in `block (2 levels) in <class:User>'
181
+
182
+
183
+
184
+
185
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
186
+
187
+
188
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
189
+
190
+
191
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
192
+
193
+ ArgumentError (wrong number of arguments (1 for 0)):
194
+ app/api/test_app/modules/user.rb:19:in `block (2 levels) in <class:User>'
195
+
196
+
197
+
198
+
199
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
200
+
201
+ ArgumentError (wrong number of arguments (1 for 0)):
202
+ app/api/test_app/modules/user.rb:19:in `block (2 levels) in <class:User>'
203
+
204
+
205
+
206
+
207
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
208
+
209
+ ArgumentError (wrong number of arguments (1 for 0)):
210
+ app/api/test_app/modules/user.rb:27:in `block (2 levels) in <class:User>'
211
+
212
+
213
+
214
+
215
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:46:33 -0500
216
+
217
+ ArgumentError (wrong number of arguments (1 for 0)):
218
+ app/api/test_app/modules/user.rb:27:in `block (2 levels) in <class:User>'
219
+
220
+
221
+
222
+
223
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
224
+
225
+
226
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
227
+
228
+
229
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
230
+
231
+
232
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
233
+
234
+
235
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
236
+
237
+
238
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:46:53 -0500
239
+
240
+
241
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:53:44 -0500
242
+
243
+
244
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:53:45 -0500
245
+
246
+
247
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:53:45 -0500
248
+
249
+
250
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:53:45 -0500
251
+
252
+
253
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:53:45 -0500
254
+
255
+
256
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:53:45 -0500
257
+
258
+
259
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:55:15 -0500
260
+
261
+
262
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:55:15 -0500
263
+
264
+
265
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:55:15 -0500
266
+
267
+
268
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:55:49 -0500
269
+
270
+
271
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:55:49 -0500
272
+
273
+
274
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:55:49 -0500
275
+
276
+
277
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
278
+
279
+
280
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
281
+
282
+
283
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
284
+
285
+
286
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
287
+
288
+
289
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
290
+
291
+
292
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 15:56:32 -0500
293
+
294
+
295
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
296
+
297
+
298
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
299
+
300
+
301
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
302
+
303
+
304
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
305
+
306
+
307
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
308
+
309
+
310
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:21:36 -0500
311
+
312
+
313
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
314
+
315
+
316
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
317
+
318
+
319
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
320
+
321
+
322
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
323
+
324
+
325
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
326
+
327
+
328
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:23:38 -0500
329
+
330
+
331
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
332
+
333
+
334
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
335
+
336
+
337
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
338
+
339
+
340
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
341
+
342
+
343
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
344
+
345
+
346
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:24:21 -0500
347
+
348
+
349
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
350
+
351
+
352
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
353
+
354
+
355
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
356
+
357
+
358
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
359
+
360
+
361
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
362
+
363
+
364
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:25:43 -0500
365
+
366
+
367
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
368
+
369
+
370
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
371
+
372
+
373
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
374
+
375
+
376
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
377
+
378
+
379
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
380
+
381
+
382
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:26:50 -0500
383
+
384
+
385
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
386
+
387
+
388
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
389
+
390
+
391
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
392
+
393
+
394
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
395
+
396
+
397
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
398
+
399
+
400
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:28:25 -0500
401
+
402
+
403
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
404
+
405
+
406
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
407
+
408
+
409
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
410
+
411
+
412
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
413
+
414
+
415
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
416
+
417
+
418
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:29:52 -0500
419
+
420
+
421
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
422
+
423
+
424
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
425
+
426
+
427
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
428
+
429
+
430
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
431
+
432
+
433
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
434
+
435
+
436
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:30:48 -0500
437
+
438
+
439
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
440
+
441
+
442
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
443
+
444
+
445
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
446
+
447
+
448
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
449
+
450
+
451
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
452
+
453
+
454
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:32:32 -0500
455
+
456
+
457
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
458
+
459
+
460
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
461
+
462
+
463
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
464
+
465
+
466
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
467
+
468
+
469
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
470
+
471
+
472
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:33:20 -0500
473
+
474
+
475
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
476
+
477
+
478
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
479
+
480
+
481
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
482
+
483
+
484
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
485
+
486
+
487
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
488
+
489
+
490
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:36:03 -0500
491
+
492
+
493
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
494
+
495
+
496
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
497
+
498
+
499
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
500
+
501
+
502
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
503
+
504
+
505
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
506
+
507
+
508
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:40:04 -0500
509
+
510
+
511
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
512
+
513
+
514
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
515
+
516
+
517
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
518
+
519
+
520
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
521
+
522
+
523
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
524
+
525
+
526
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:43:01 -0500
527
+
528
+
529
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
530
+
531
+
532
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
533
+
534
+
535
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
536
+
537
+
538
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
539
+
540
+
541
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
542
+
543
+
544
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:49:28 -0500
545
+
546
+
547
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
548
+
549
+
550
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
551
+
552
+
553
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
554
+
555
+
556
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
557
+
558
+
559
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
560
+
561
+
562
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:51:44 -0500
563
+
564
+
565
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
566
+
567
+
568
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
569
+
570
+
571
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
572
+
573
+
574
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
575
+
576
+
577
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
578
+
579
+
580
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:51:59 -0500
581
+
582
+
583
+ Started GET "/api/v1/animals/foo" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
584
+
585
+
586
+ Started GET "/api/v1/animals/bar/0" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
587
+
588
+
589
+ Started GET "/api/v1/users" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
590
+
591
+
592
+ Started GET "/api/v1/users/compact" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
593
+
594
+
595
+ Started GET "/api/v1/users/0" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
596
+
597
+
598
+ Started GET "/api/v1/users/compact/0" for 127.0.0.1 at 2014-11-20 18:56:10 -0500
@@ -1 +1 @@
1
- o: ActiveSupport::Cache::Entry: @value{I" Food:ETI"TestApp::Entities::Food;TI" User;TI"&TestApp::Entities::Users::Default;T:@created_atf1416429972.351149:@expires_in0
1
+ o: ActiveSupport::Cache::Entry: @value{I" Food:ETI"TestApp::Entities::Food;TI" User;TI"&TestApp::Entities::Users::Default;T:@created_atf1416527769.8784719:@expires_in0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-transformations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Tique
@@ -255,8 +255,10 @@ files:
255
255
  - Rakefile
256
256
  - lib/grape/generators/templates/entity.rb
257
257
  - lib/grape/generators/templates/grape-transformations.rb
258
+ - lib/grape/generators/templates/module.rb
258
259
  - lib/grape/generators/transformations/entity_generator.rb
259
260
  - lib/grape/generators/transformations/install_generator.rb
261
+ - lib/grape/generators/transformations/module_generator.rb
260
262
  - lib/grape/tasks/grape_transformations_tasks.rake
261
263
  - lib/grape/transformations.rb
262
264
  - lib/grape/transformations/base.rb
@@ -267,6 +269,7 @@ files:
267
269
  - spec/api/user_spec.rb
268
270
  - spec/generators/entity_generator_spec.rb
269
271
  - spec/generators/install_generator_spec.rb
272
+ - spec/generators/module_generator_spec.rb
270
273
  - spec/grape_transformations_spec.rb
271
274
  - spec/spec_helper.rb
272
275
  - spec/test_app/README.rdoc
@@ -347,6 +350,7 @@ test_files:
347
350
  - spec/api/user_spec.rb
348
351
  - spec/generators/entity_generator_spec.rb
349
352
  - spec/generators/install_generator_spec.rb
353
+ - spec/generators/module_generator_spec.rb
350
354
  - spec/grape_transformations_spec.rb
351
355
  - spec/spec_helper.rb
352
356
  - spec/test_app/app/api/api.rb