class Brainstem::ApiDocs::EndpointCollection
Attributes
include_internal[RW]
Public Instance Methods
create_from_route(route, controller)
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 28 def create_from_route(route, controller) Endpoint.new(atlas, include_internal: self.include_internal) do |ep| ep.path = route[:path] ep.http_methods = route[:http_methods] ep.controller = controller ep.controller_name = route[:controller_name] ep.action = route[:action] end.tap { |endpoint| self.<< endpoint } end
find_from_route(route)
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 18 def find_from_route(route) find do |endpoint| endpoint.path == route[:path] && endpoint.controller.const == route[:controller] && endpoint.action == route[:action] end end
Also aliased as: find_by_route
only_documentable()
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 38 def only_documentable self.class.with_members(atlas, reject(&:nodoc?)) end
sorted()
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 46 def sorted self.class.with_members(atlas, sort) end
sorted_with_actions_in_controller(const)
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 54 def sorted_with_actions_in_controller(const) with_actions_in_controller(const).sorted end
valid_options()
click to toggle source
Calls superclass method
Brainstem::Concerns::Formattable#valid_options
# File lib/brainstem/api_docs/endpoint_collection.rb, line 12 def valid_options super | [ :include_internal ] end
with_actions_in_controller(const)
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 50 def with_actions_in_controller(const) self.class.with_members(atlas, reject { |m| !const.method_defined?(m.action) }) end
with_declared_presented_class()
click to toggle source
# File lib/brainstem/api_docs/endpoint_collection.rb, line 42 def with_declared_presented_class self.class.with_members(atlas, reject { |m| m.declared_presented_class.nil? }) end