Class: Swagger::Data::Scopes
- Inherits:
-
Object
- Object
- Object
- Swagger::Data::Scopes
show all
- Defined in:
- lib/ruby-swagger/data/scopes.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
Constructor Details
#initialize ⇒ Scopes
Returns a new instance of Scopes.
6
7
8
|
# File 'lib/ruby-swagger/data/scopes.rb', line 6
def initialize
@scopes = {}
end
|
Class Method Details
.parse(scopes) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/ruby-swagger/data/scopes.rb', line 10
def self.parse(scopes)
return nil unless scopes
scope = Swagger::Data::Scopes.new
scopes.each do |scope_name, scope_value|
scope.add_scope(scope_name, scope_value)
end
scope
end
|
Instance Method Details
#[](scope) ⇒ Object
29
30
31
|
# File 'lib/ruby-swagger/data/scopes.rb', line 29
def [](scope)
@scopes[scope]
end
|
#add_scope(scope_name, scope_value) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/ruby-swagger/data/scopes.rb', line 22
def add_scope(scope_name, scope_value)
raise ArgumentError.new("Swagger::Data::Scopes#add_scope - scope_name is nil") unless scope_name
raise ArgumentError.new("Swagger::Data::Scopes#add_scope - scope_value is nil") unless scope_value
@scopes[scope_name] = scope_value
end
|
#as_swagger ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/ruby-swagger/data/scopes.rb', line 33
def as_swagger
swagger_scopes = {}
@scopes.each do |scope_k, scope_v|
swagger_scopes[scope_k] = scope_v
end
swagger_scopes
end
|