Class: Swagger::Grape::RoutePath
- Inherits:
-
Object
- Object
- Swagger::Grape::RoutePath
- Defined in:
- lib/ruby-swagger/grape/route_path.rb
Instance Attribute Summary collapse
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #add_operation(route) ⇒ Object
-
#initialize(route_name) ⇒ RoutePath
constructor
A new instance of RoutePath.
- #to_swagger ⇒ Object
Constructor Details
#initialize(route_name) ⇒ RoutePath
Returns a new instance of RoutePath.
9 10 11 12 13 14 |
# File 'lib/ruby-swagger/grape/route_path.rb', line 9 def initialize(route_name) @name = route_name @operations = {} @types = [] @scopes = [] end |
Instance Attribute Details
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
7 8 9 |
# File 'lib/ruby-swagger/grape/route_path.rb', line 7 def scopes @scopes end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
7 8 9 |
# File 'lib/ruby-swagger/grape/route_path.rb', line 7 def types @types end |
Instance Method Details
#add_operation(route) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/ruby-swagger/grape/route_path.rb', line 16 def add_operation(route) method = Swagger::Grape::Method.new(@name, route) grape_operation = method.operation @types = (@types | method.types).uniq @scopes = (@scopes | method.scopes).uniq @operations[route.route_method.downcase] = grape_operation end |