Class: Swagger::Blocks::ApiAuthorizationNode

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

Overview

NOTE: in the spec this is different than Resource Listing’s authorization. goo.gl/PvwUXj#515-authorization-object

Instance Attribute Summary

Attributes inherited from Node

#name

Instance Method Summary collapse

Methods inherited from Node

call, #data, #key

Instance Method Details

#as_jsonObject



341
342
343
344
345
346
# File 'lib/swagger/blocks.rb', line 341

def as_json
  # Special case: the API Authorization object is weirdly the only array of hashes.
  # Override the default hash behavior and return an array.
  self.data[:_scopes] ||= []
  self.data[:_scopes].map { |s| s.as_json }
end

#scope(&block) ⇒ Object



348
349
350
351
# File 'lib/swagger/blocks.rb', line 348

def scope(&block)
  self.data[:_scopes] ||= []
  self.data[:_scopes] << Swagger::Blocks::ApiAuthorizationScopeNode.call(&block)
end