Class: Swagger::Blocks::ResourceListingAuthorizationNode

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

Overview

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

Constant Summary collapse

GRANT_TYPES =
[:implicit, :authorization_code].freeze

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

Instance Method Details

#grant_type(name, &block) ⇒ Object

Raises:

  • (ArgumentError)


369
370
371
372
373
374
375
# File 'lib/swagger/blocks.rb', line 369

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].version = version
  self.data[:grantTypes].implicit(&block) if name == :implicit
  self.data[:grantTypes].authorization_code(&block) if name == :authorization_code
end

#scope(&block) ⇒ Object



364
365
366
367
# File 'lib/swagger/blocks.rb', line 364

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