Module: ManageIQ::API::Common::ApplicationControllerMixins::RequestPath
- Defined in:
- lib/manageiq/api/common/application_controller_mixins/request_path.rb
Defined Under Namespace
Modules: ClassMethods
Classes: RequestPathError
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(other) ⇒ Object
Instance Method Details
#request_path ⇒ Object
20
21
22
|
# File 'lib/manageiq/api/common/application_controller_mixins/request_path.rb', line 20
def request_path
request.env["REQUEST_URI"]
end
|
#request_path_parts ⇒ Object
24
25
26
27
28
29
|
# File 'lib/manageiq/api/common/application_controller_mixins/request_path.rb', line 24
def request_path_parts
@request_path_parts ||= begin
path, _query = request_path.split("?")
path.match(/\/(?<full_version_string>v\d+.\d+)\/(?<primary_collection_name>\w+)(\/(?<primary_collection_id>[^\/]+)(\/(?<subcollection_name>\w+))?)?/)&.named_captures || {}
end
end
|
#subcollection? ⇒ Boolean
31
32
33
|
# File 'lib/manageiq/api/common/application_controller_mixins/request_path.rb', line 31
def subcollection?
!!(request_path_parts["subcollection_name"] && request_path_parts["primary_collection_id"] && request_path_parts["primary_collection_name"])
end
|