Class: ManageIQ::API::Common::Routing
- Inherits:
-
Object
- Object
- ManageIQ::API::Common::Routing
- Defined in:
- lib/manageiq/api/common/routing.rb
Instance Attribute Summary collapse
-
#route_mapper ⇒ Object
readonly
Returns the value of attribute route_mapper.
Instance Method Summary collapse
-
#initialize(route_mapper) ⇒ Routing
constructor
A new instance of Routing.
- #redirect_major_version(version, prefix, via: [:delete, :get, :options, :patch, :post]) ⇒ Object
Constructor Details
#initialize(route_mapper) ⇒ Routing
Returns a new instance of Routing.
7 8 9 |
# File 'lib/manageiq/api/common/routing.rb', line 7 def initialize(route_mapper) @route_mapper = route_mapper end |
Instance Attribute Details
#route_mapper ⇒ Object (readonly)
Returns the value of attribute route_mapper.
5 6 7 |
# File 'lib/manageiq/api/common/routing.rb', line 5 def route_mapper @route_mapper end |
Instance Method Details
#redirect_major_version(version, prefix, via: [:delete, :get, :options, :patch, :post]) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/manageiq/api/common/routing.rb', line 11 def redirect_major_version(version, prefix, via: [:delete, :get, :options, :patch, :post]) route_mapper.match( "/#{version.split('.').first}/*path(.:format)", :format => false, :via => via, :to => route_mapper.redirect( :path => "/#{prefix}/#{version}/%{path}", :only_path => true, :status => 302 ) ) end |