lotus-router 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f107f75de95beb2c60e374aa29060d63aca3d70
4
- data.tar.gz: deae89af0716937eedbbf8fcc8b515fc72740e26
3
+ metadata.gz: 221714d5d9c1a560423ad18e2153c17d88200680
4
+ data.tar.gz: 41706f3509decc6458e1852f53c5e404e30e4239
5
5
  SHA512:
6
- metadata.gz: 484220d7305ec7efcd59e4453a03d45d306b643761f5dd2df5c06f7b5a06e6a06bb414d6921c0c0089b6e868620f7cd268184412ce5d62c36af39a2ea544597d
7
- data.tar.gz: bd6aa7be6fcbfb0adb483d912757a68a46e3a71dcc0961d3efa72906db6bfeab042e9d382c7aa7d7e8bb7be105d5d2ffaeea300671794f8770df6a3b6a83778f
6
+ metadata.gz: aaa5c9a07b4ca993792027a16b6ebaa62fe1c2b5ce48a85921ee4c3fa9efdc81884016c48efddb6280708c4fcd1b4a5d0653f4fad6493a3ba6e2b224850ebee7
7
+ data.tar.gz: 7e0f8ad5a549698236d8ee46d4b6d7d5af2029d9a1034db599a234b1098aa27809993bc77d8fe638a2353a59726c359d014c954b056da9a521a5b384c51a6fb1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Lotus::Router
2
2
  Rack compatible HTTP router for Ruby
3
3
 
4
+ ## v0.3.0 - 2015-03-23
5
+
4
6
  ## v0.2.1 - 2015-01-30
5
7
  ### Added
6
8
  - [Alfonso Uceda Pompa] Lotus::Action compat: invoke `.call` if defined, otherwise fall back to `#call`.
data/README.md CHANGED
@@ -398,6 +398,16 @@ router.path(:authorizations_identity) # => /identity/authorizations
398
398
  ```
399
399
 
400
400
 
401
+ Configure controller:
402
+
403
+ ```ruby
404
+ router = Lotus::Router.new
405
+ router.resource 'profile', controller: 'identity'
406
+
407
+ router.path(:profile) # => /profile # Will route to Identity::Show
408
+ ```
409
+
410
+
401
411
 
402
412
  ### RESTful Resources:
403
413
 
@@ -506,6 +516,16 @@ router.path(:toggle_flowers, id: 23) # => /flowers/23/toggle
506
516
  router.path(:search_flowers) # => /flowers/search
507
517
  ```
508
518
 
519
+
520
+ Configure controller:
521
+
522
+ ```ruby
523
+ router = Lotus::Router.new
524
+ router.resources 'blossoms', controller: 'flowers'
525
+
526
+ router.path(:blossoms, id: 23) # => /blossoms/23 # Will route to Flowers::Show
527
+ ```
528
+
509
529
  ## Testing
510
530
 
511
531
  ```ruby
@@ -1,6 +1,6 @@
1
1
  module Lotus
2
2
  class Router
3
3
  # @since 0.1.0
4
- VERSION = '0.2.1'.freeze
4
+ VERSION = '0.3.0'.freeze
5
5
  end
6
6
  end
@@ -206,7 +206,7 @@ module Lotus
206
206
  # @api private
207
207
  # @since 0.1.0
208
208
  def endpoint
209
- [ resource_name, action_name ].join separator
209
+ [ controller_name, action_name ].join separator
210
210
  end
211
211
 
212
212
  # Separator between controller and action name
@@ -221,6 +221,22 @@ module Lotus
221
221
  def separator
222
222
  @options[:separator]
223
223
  end
224
+
225
+ # Resource controller name
226
+ #
227
+ # @example
228
+ # Lotus::Router.new do
229
+ # resources 'flowers', controller: 'rocks'
230
+ # end
231
+ #
232
+ # # It will mount path 'flowers/new' to Rocks::New instead of Flowers::New
233
+ # # Same for other action names
234
+ #
235
+ # @api private
236
+ # @since x.x.x
237
+ def controller_name
238
+ @options[:controller] || resource_name
239
+ end
224
240
  end
225
241
 
226
242
  # Collection action
@@ -249,7 +265,7 @@ module Lotus
249
265
  end
250
266
 
251
267
  def endpoint(action_name)
252
- [ resource_name, action_name ].join separator
268
+ [ controller_name, action_name ].join separator
253
269
  end
254
270
 
255
271
  def as(action_name)
@@ -21,6 +21,7 @@ module Lotus
21
21
  # @param options [Hash]
22
22
  # @option options [Hash] :only white list of the default actions
23
23
  # @option options [Hash] :except black list of the default actions
24
+ # @option options [String] :controller namespace for an actions
24
25
  #
25
26
  # @api private
26
27
  # @since 0.1.0
data/lotus-router.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = '>= 2.0.0'
21
21
 
22
22
  spec.add_dependency 'http_router', '~> 0.11'
23
- spec.add_dependency 'lotus-utils', '~> 0.3', '>= 0.3.2'
23
+ spec.add_dependency 'lotus-utils', '~> 0.4'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.5'
26
26
  spec.add_development_dependency 'minitest', '~> 5'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotus-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-30 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http_router
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.3'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.3.2
33
+ version: '0.4'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '0.3'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.3.2
40
+ version: '0.4'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: bundler
49
43
  requirement: !ruby/object:Gem::Requirement