Class: Swagger::Data::SecurityScheme
- Inherits:
-
Object
- Object
- Object
- Swagger::Data::SecurityScheme
show all
- Defined in:
- lib/ruby-swagger/data/security_scheme.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Object
attr_swagger, #bulk_set, #swagger_attributes, #to_json, #to_swagger, #to_yaml
Class Method Details
.parse(security) ⇒ Object
9
10
11
12
13
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 9
def self.parse(security)
return nil unless security
Swagger::Data::SecurityScheme.new.bulk_set(security)
end
|
Instance Method Details
#authorizationUrl=(new_authorizationUrl) ⇒ Object
46
47
48
49
50
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 46
def authorizationUrl=(new_authorizationUrl)
raise ArgumentError.new("Security::Data::SecurityScheme#authorizationUrl= - authorizationUrl is nil") if @type == 'oauth2' && (@flow == 'implicit' || @flow == 'accessCode') && !new_authorizationUrl
@authorizationUrl = new_authorizationUrl
end
|
#flow=(new_flow) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 37
def flow=(new_flow)
if @type == 'oauth2'
raise ArgumentError.new("Security::Data::SecurityScheme#flow= - flow is nil") if !new_flow
raise ArgumentError.new("Security::Data::SecurityScheme#flow= - unrecognized flow #{new_flow}") unless %w(implicit password application accessCode).include?(new_flow)
end
@flow = new_flow
end
|
#in=(new_in) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 28
def in=(new_in)
if @type == 'apiKey'
raise ArgumentError.new("Security::Data::SecurityScheme#in= - in is nil") if !new_in
raise ArgumentError.new("Security::Data::SecurityScheme#in= - unrecognized in #{new_in}") unless %w(query header).include?(new_in)
end
@in = new_in
end
|
#name=(new_name) ⇒ Object
22
23
24
25
26
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 22
def name=(new_name)
raise ArgumentError.new("Security::Data::SecurityScheme#name= - name is nil") if @type == 'apiKey' && !new_name
@name = new_name
end
|
#scopes=(new_scopes) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 58
def scopes=(new_scopes)
raise ArgumentError.new("Security::Data::SecurityScheme#scopes= - scopes is nil") if @type == 'oauth2' && !new_scopes
new_scopes = Swagger::Data::Scopes.parse(new_scopes) if(!new_scopes.is_a?(Swagger::Data::Scopes))
@scopes = new_scopes
end
|
#tokenUrl=(new_tokenUrl) ⇒ Object
52
53
54
55
56
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 52
def tokenUrl=(new_tokenUrl)
raise ArgumentError.new("Security::Data::SecurityScheme#tokenUrl= - tokenUrl is nil") if @type == 'oauth2' && (@flow == 'password' || @flow == 'application' || @flow == 'accessCode') && !new_tokenUrl
@tokenUrl = new_tokenUrl
end
|
#type=(new_type) ⇒ Object
15
16
17
18
19
20
|
# File 'lib/ruby-swagger/data/security_scheme.rb', line 15
def type=(new_type)
raise ArgumentError.new("Security::Data::SecurityScheme#type= - type is nil") unless new_type
raise ArgumentError.new("Security::Data::SecurityScheme#type= - unrecognized type #{new_type}") unless %w(basic apiKey oauth2).include?(new_type)
@type = new_type
end
|