Class: Simple::OAuth2::Scopes
- Inherits:
-
Object
- Object
- Simple::OAuth2::Scopes
- Defined in:
- lib/simple_oauth2/scopes.rb
Overview
Scopes helper for scopes validation
Class Method Summary collapse
-
.valid?(access_scopes, scopes) ⇒ Boolean
Checks if requested scopes are valid.
Instance Method Summary collapse
-
#initialize(access_scopes, scopes = []) ⇒ Scopes
constructor
Helper class initializer.
-
#valid? ⇒ Boolean
Checks if requested scopes (passed and processed on initialization) are presented in the AccessToken.
Constructor Details
#initialize(access_scopes, scopes = []) ⇒ Scopes
Helper class initializer
19 20 21 22 |
# File 'lib/simple_oauth2/scopes.rb', line 19 def initialize(access_scopes, scopes = []) @scopes = to_array(scopes) @access_scopes = to_array(access_scopes) end |
Class Method Details
.valid?(access_scopes, scopes) ⇒ Boolean
Checks if requested scopes are valid
10 11 12 |
# File 'lib/simple_oauth2/scopes.rb', line 10 def self.valid?(access_scopes, scopes) new(access_scopes, scopes).valid? end |
Instance Method Details
#valid? ⇒ Boolean
Checks if requested scopes (passed and processed on initialization) are presented in the AccessToken
28 29 30 |
# File 'lib/simple_oauth2/scopes.rb', line 28 def valid? @scopes.empty? || present_in_access_token? end |