Sha256: e5f473b9eee58b898e66416f8f119381e62137aafc367973311360f30e4ed53c
Contents?: true
Size: 728 Bytes
Versions: 1
Compression:
Stored size: 728 Bytes
Contents
module SwaggerYard class Authorization attr_reader :pass_as, :key attr_writer :name def self.from_yard_object(yard_object) new(yard_object.types.first, yard_object.name, yard_object.text) end def initialize(type, pass_as, key) @type, @pass_as, @key = type, pass_as, key end # the spec suggests most auth names are just the type of auth def name @name ||= [@pass_as, @key].join('_').downcase.gsub('-', '_') end def type case @type when "api_key" "apiKey" when "basic_auth" "basicAuth" end end def to_h { "type" => type, "passAs" => @pass_as, "keyname" => @key } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
swagger_yard-0.1.0 | lib/swagger_yard/authorization.rb |