Class: Swaggable::EndpointDefinition
- Inherits:
-
Object
- Object
- Swaggable::EndpointDefinition
- Includes:
- ForwardingDsl::Getsetter
- Defined in:
- lib/swaggable/endpoint_definition.rb
Instance Method Summary collapse
- #configure(&block) ⇒ Object
- #consumes ⇒ Object
-
#initialize(args = {}, &block) ⇒ EndpointDefinition
constructor
A new instance of EndpointDefinition.
- #parameters ⇒ Object
- #produces ⇒ Object
- #responses ⇒ Object
- #tags ⇒ Object
Constructor Details
#initialize(args = {}, &block) ⇒ EndpointDefinition
Returns a new instance of EndpointDefinition.
15 16 17 18 |
# File 'lib/swaggable/endpoint_definition.rb', line 15 def initialize args = {}, &block args.each {|k, v| self.send("#{k}=", v) } configure(&block) if block_given? end |
Instance Method Details
#configure(&block) ⇒ Object
49 50 51 52 |
# File 'lib/swaggable/endpoint_definition.rb', line 49 def configure &block ForwardingDsl.run(self, &block) self end |
#consumes ⇒ Object
41 42 43 |
# File 'lib/swaggable/endpoint_definition.rb', line 41 def consumes @consumes ||= [] end |
#parameters ⇒ Object
27 28 29 30 31 32 |
# File 'lib/swaggable/endpoint_definition.rb', line 27 def parameters @parameters ||= MiniObject::IndexedList.new.tap do |l| l.build { ParameterDefinition.new } l.key {|e| e.name } end end |
#produces ⇒ Object
45 46 47 |
# File 'lib/swaggable/endpoint_definition.rb', line 45 def produces @produces ||= [] end |
#responses ⇒ Object
34 35 36 37 38 39 |
# File 'lib/swaggable/endpoint_definition.rb', line 34 def responses @responses ||= MiniObject::IndexedList.new.tap do |l| l.build { ResponseDefinition.new } l.key {|e| e.status } end end |
#tags ⇒ Object
20 21 22 23 24 25 |
# File 'lib/swaggable/endpoint_definition.rb', line 20 def @tags ||= MiniObject::IndexedList.new.tap do |l| l.build { TagDefinition.new } l.key {|e| e.name } end end |