Class: SiriusApi::Scopes

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/sirius_api/scopes.rb

Constant Summary collapse

READ_ALL =
['cvut:sirius:all:read', 'urn:ctu:oauth:sirius:read'].freeze
READ_PERSONAL =
['cvut:sirius:personal:read', 'urn:ctu:oauth:sirius:personal:read'].freeze
READ_ROLE_BASED =
['cvut:sirius:limited-by-idm:read', 'urn:ctu:oauth:sirius.read',
'urn:ctu:oauth:sirius:limited-by-idm:read'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*scopes) ⇒ Scopes

Returns a new instance of Scopes.


17
18
19
# File 'lib/sirius_api/scopes.rb', line 17

def initialize(*scopes)
  @scopes = Set.new(scopes.flatten)
end

Instance Attribute Details

#scopesObject (readonly)

Returns the value of attribute scopes


15
16
17
# File 'lib/sirius_api/scopes.rb', line 15

def scopes
  @scopes
end

Instance Method Details

#include_any?(items) ⇒ Boolean

Returns:

  • (Boolean)

25
26
27
28
# File 'lib/sirius_api/scopes.rb', line 25

def include_any?(items)
  items_set = Array(items).to_set
  !(scopes & items_set).empty?
end

#to_sObject


21
22
23
# File 'lib/sirius_api/scopes.rb', line 21

def to_s
  scopes.to_s
end