Class: Swagger::Blocks::ResourceListingNode

Inherits:
Node
  • Object
show all
Defined in:
lib/swagger/blocks.rb

Overview

Instance Attribute Summary

Attributes inherited from Node

#name

Instance Method Summary collapse

Methods inherited from Node

#as_json, call, #data, #key

Constructor Details

#initialize(*args) ⇒ ResourceListingNode

Returns a new instance of ResourceListingNode.



171
172
173
174
175
# File 'lib/swagger/blocks.rb', line 171

def initialize(*args)
  # An internal list of the user-defined names that uniquely identify each API tree.
  @api_paths = []
  super
end

Instance Method Details

#api(&block) ⇒ Object



191
192
193
194
# File 'lib/swagger/blocks.rb', line 191

def api(&block)
  self.data[:apis] ||= []
  self.data[:apis] << Swagger::Blocks::ResourceNode.call(&block)
end

#authorization(name, &block) ⇒ Object



186
187
188
189
# File 'lib/swagger/blocks.rb', line 186

def authorization(name, &block)
  self.data[:authorizations] ||= Swagger::Blocks::ResourceListingAuthorizationsNode.new
  self.data[:authorizations].authorization(name, &block)
end

#has_api_path?(api_path) ⇒ Boolean

Returns:

  • (Boolean)


177
178
179
180
# File 'lib/swagger/blocks.rb', line 177

def has_api_path?(api_path)
  api_paths = self.data[:apis].map { |x| x.data[:path] }
  api_paths.include?(api_path)
end

#info(&block) ⇒ Object



182
183
184
# File 'lib/swagger/blocks.rb', line 182

def info(&block)
  self.data[:info] = InfoNode.call(&block)
end