class SwaggerYard::Authorization
Attributes
description[R]
id[W]
key[W]
name[R]
type[R]
Public Class Methods
from_yard_object(yard_object)
click to toggle source
# File lib/swagger_yard/authorization.rb, line 6 def self.from_yard_object(yard_object) new(yard_object.types.first, yard_object.name, yard_object.text) end
new(type, name, description)
click to toggle source
# File lib/swagger_yard/authorization.rb, line 10 def initialize(type, name, description) @type, @name, @description = type, name, description @key = nil end
Public Instance Methods
id()
click to toggle source
# File lib/swagger_yard/authorization.rb, line 23 def id @id ||= api_key_id || name end
key()
click to toggle source
# File lib/swagger_yard/authorization.rb, line 15 def key return @key if @key return nil unless @description return nil unless @type =~ /api_?key|bearer/i @key, @description = @description.split(' ', 2) @key end
Private Instance Methods
api_key_id()
click to toggle source
# File lib/swagger_yard/authorization.rb, line 28 def api_key_id case type when /api_?key/i [name, key].compact.join('_').downcase.gsub('-', '_') else nil end end