Class: Swagger::Blocks::ResourceListingAuthorizationNode

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

Overview

NOTE: in the spec this is different than API Declaration authorization. goo.gl/PvwUXj#515-authorization-object

Constant Summary collapse

GRANT_TYPES =
[:implicit, :authorization_code].freeze

Instance Attribute Summary

Attributes inherited from Node

#name

Instance Method Summary collapse

Methods inherited from Node

#as_json, call, #data, #key

Instance Method Details

#grant_type(name, &block) ⇒ Object

Raises:

  • (ArgumentError)


218
219
220
221
222
223
# File 'lib/swagger/blocks.rb', line 218

def grant_type(name, &block)
  raise ArgumentError.new("#{name} not in #{GRANT_TYPES}") if !GRANT_TYPES.include?(name)
  self.data[:grantTypes] ||= Swagger::Blocks::GrantTypesNode.new
  self.data[:grantTypes].implicit(&block) if name == :implicit
  self.data[:grantTypes].authorization_code(&block) if name == :authorization_code
end

#scope(&block) ⇒ Object



213
214
215
216
# File 'lib/swagger/blocks.rb', line 213

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