Class: SwaggerYard::Authorization
- Inherits:
-
Object
- Object
- SwaggerYard::Authorization
- Defined in:
- lib/swagger_yard/authorization.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
- #id ⇒ Object
- #key ⇒ Object
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, name, description) ⇒ Authorization
constructor
A new instance of Authorization.
Constructor Details
#initialize(type, name, description) ⇒ Authorization
Returns a new instance of Authorization.
10 11 12 13 |
# File 'lib/swagger_yard/authorization.rb', line 10 def initialize(type, name, description) @type, @name, @description = type, name, description @key = nil end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/swagger_yard/authorization.rb', line 3 def description @description end |
#id ⇒ Object
23 24 25 |
# File 'lib/swagger_yard/authorization.rb', line 23 def id @id ||= api_key_id || name end |
#key ⇒ Object
15 16 17 18 19 20 21 |
# 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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/swagger_yard/authorization.rb', line 3 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/swagger_yard/authorization.rb', line 3 def type @type end |
Class Method Details
.from_yard_object(yard_object) ⇒ Object
6 7 8 |
# 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 |