Class: Simple::OAuth2::Scopes

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_oauth2/scopes.rb

Overview

Scopes helper for scopes validation

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_scopes, scopes = []) ⇒ Scopes

Returns a new instance of Scopes.


9
10
11
12
# File 'lib/simple_oauth2/scopes.rb', line 9

def initialize(access_scopes, scopes = [])
  @scopes = to_array(scopes)
  @access_scopes = to_array(access_scopes)
end

Class Method Details

.valid?(scopes, access_scopes) ⇒ Boolean

Returns:

  • (Boolean)

5
6
7
# File 'lib/simple_oauth2/scopes.rb', line 5

def self.valid?(scopes, access_scopes)
  new(scopes, access_scopes).valid?
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)

14
15
16
# File 'lib/simple_oauth2/scopes.rb', line 14

def valid?
  @scopes.empty? || present_in_access_token?
end