Class: SwaggerYard::Specification
- Inherits:
-
Object
- Object
- SwaggerYard::Specification
- Defined in:
- lib/swagger_yard/specification.rb
Instance Attribute Summary collapse
-
#authorizations ⇒ Object
Returns the value of attribute authorizations.
Instance Method Summary collapse
-
#initialize(controller_path = SwaggerYard.config.controller_path, model_path = SwaggerYard.config.model_path) ⇒ Specification
constructor
A new instance of Specification.
- #model_objects ⇒ Object
- #path_objects ⇒ Object
- #security_objects ⇒ Object
-
#tag_objects ⇒ Object
Resources.
Constructor Details
#initialize(controller_path = SwaggerYard.config.controller_path, model_path = SwaggerYard.config.model_path) ⇒ Specification
Returns a new instance of Specification.
5 6 7 8 9 10 11 12 |
# File 'lib/swagger_yard/specification.rb', line 5 def initialize(controller_path = SwaggerYard.config.controller_path, model_path = SwaggerYard.config.model_path) @model_paths = [*model_path].compact @controller_paths = [*controller_path].compact @resource_to_file_path = {} @authorizations = [] end |
Instance Attribute Details
#authorizations ⇒ Object
Returns the value of attribute authorizations.
3 4 5 |
# File 'lib/swagger_yard/specification.rb', line 3 def @authorizations end |
Instance Method Details
#model_objects ⇒ Object
25 26 27 |
# File 'lib/swagger_yard/specification.rb', line 25 def model_objects Hash[models.map {|m| [m.id, m]}] end |
#path_objects ⇒ Object
14 15 16 17 18 |
# File 'lib/swagger_yard/specification.rb', line 14 def path_objects api_groups.map(&:paths).reduce(Paths.new({}), :merge).tap do |paths| warn_duplicate_operations(paths) end end |
#security_objects ⇒ Object
29 30 31 32 |
# File 'lib/swagger_yard/specification.rb', line 29 def security_objects api_groups # triggers controller parsing in case it did not happen before Hash[.map {|auth| [auth.id, auth]}] end |
#tag_objects ⇒ Object
Resources
21 22 23 |
# File 'lib/swagger_yard/specification.rb', line 21 def tag_objects api_groups.map(&:tag) end |