Class: Swagger::Blocks::RootNode
- Inherits:
-
Node
- Object
- Node
- Swagger::Blocks::RootNode
show all
- Defined in:
- lib/swagger/blocks.rb
Instance Attribute Summary
Attributes inherited from Node
#name, #version
Instance Method Summary
collapse
Methods inherited from Node
#as_json, call, #data, #is_swagger_1_2?, #is_swagger_2_0?, #key
Constructor Details
#initialize(*args) ⇒ RootNode
Returns a new instance of RootNode.
276
277
278
279
280
281
282
|
# File 'lib/swagger/blocks.rb', line 276
def initialize(*args)
@api_paths = []
super
end
|
Instance Method Details
#api(&block) ⇒ Object
303
304
305
306
307
308
|
# File 'lib/swagger/blocks.rb', line 303
def api(&block)
raise NotSupportedError unless is_swagger_1_2?
self.data[:apis] ||= []
self.data[:apis] << Swagger::Blocks::ResourceNode.call(version: version, &block)
end
|
#authorization(name, &block) ⇒ Object
291
292
293
294
295
296
297
|
# File 'lib/swagger/blocks.rb', line 291
def authorization(name, &block)
raise NotSupportedError unless is_swagger_1_2?
self.data[:authorizations] ||= Swagger::Blocks::ResourceListingAuthorizationsNode.new
self.data[:authorizations].version = version
self.data[:authorizations].authorization(name, &block)
end
|
#has_api_path?(api_path) ⇒ Boolean
284
285
286
287
288
289
|
# File 'lib/swagger/blocks.rb', line 284
def has_api_path?(api_path)
raise NotSupportedError unless is_swagger_1_2?
api_paths = self.data[:apis].map { |x| x.data[:path] }
api_paths.include?(api_path)
end
|
#info(&block) ⇒ Object
299
300
301
|
# File 'lib/swagger/blocks.rb', line 299
def info(&block)
self.data[:info] = Swagger::Blocks::InfoNode.call(version: version, &block)
end
|
#parameter(param, &block) ⇒ Object
310
311
312
313
314
315
316
|
# File 'lib/swagger/blocks.rb', line 310
def parameter(param, &block)
raise NotSupportedError unless is_swagger_2_0?
self.data[:parameters] ||= {}
self.data[:parameters][param] = Swagger::Blocks::ParameterNode.call(version: version, &block)
end
|
#response(resp, &block) ⇒ Object
318
319
320
321
322
323
324
|
# File 'lib/swagger/blocks.rb', line 318
def response(resp, &block)
raise NotSupportedError unless is_swagger_2_0?
self.data[:responses] ||= {}
self.data[:responses][resp] = Swagger::Blocks::ResponseNode.call(version: version, &block)
end
|
#security(&block) ⇒ Object
333
334
335
336
337
338
|
# File 'lib/swagger/blocks.rb', line 333
def security(&block)
raise NotSupportedError unless is_swagger_2_0?
self.data[:security] ||= []
self.data[:security] << Swagger::Blocks::SecurityRequirementNode.call(version: version, &block)
end
|
#security_definition(name, &block) ⇒ Object
326
327
328
329
330
331
|
# File 'lib/swagger/blocks.rb', line 326
def security_definition(name, &block)
raise NotSupportedError unless is_swagger_2_0?
self.data[:securityDefinitions] ||= {}
self.data[:securityDefinitions][name] = Swagger::Blocks::SecuritySchemeNode.call(version: version, &block)
end
|
340
341
342
343
344
345
|
# File 'lib/swagger/blocks.rb', line 340
def tags(&block)
raise NotSupportedError unless is_swagger_2_0?
self.data[:tags] ||= []
self.data[:tags] << Swagger::Blocks::TagNode.call(version: version, &block)
end
|