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, #keys

Instance Method Details

#grant_type(name, inline_keys = nil, &block) ⇒ Object

Raises:

  • (ArgumentError)


378
379
380
381
382
383
384
# File 'lib/swagger/blocks.rb', line 378

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

#scope(inline_keys = nil, &block) ⇒ Object



373
374
375
376
# File 'lib/swagger/blocks.rb', line 373

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