Class: BookingsyncApplication::Controllers::BookingsyncUniverseApiAccess::AuthorizationScope
- Inherits:
-
Object
- Object
- BookingsyncApplication::Controllers::BookingsyncUniverseApiAccess::AuthorizationScope
- Defined in:
- lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb
Class Method Summary collapse
Instance Method Summary collapse
- #account_id ⇒ Object
- #allows_access_for?(required_scopes) ⇒ Boolean
-
#initialize(response_hash) ⇒ AuthorizationScope
constructor
A new instance of AuthorizationScope.
- #scopes ⇒ Object
Constructor Details
#initialize(response_hash) ⇒ AuthorizationScope
Returns a new instance of AuthorizationScope.
50 51 52 |
# File 'lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb', line 50 def initialize(response_hash) @response_hash = response_hash end |
Class Method Details
.from_response(response) ⇒ Object
46 47 48 |
# File 'lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb', line 46 def self.from_response(response) new(JSON.parse(response.body)) end |
Instance Method Details
#account_id ⇒ Object
58 59 60 |
# File 'lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb', line 58 def account_id auth.fetch("account_id") end |
#allows_access_for?(required_scopes) ⇒ Boolean
62 63 64 |
# File 'lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb', line 62 def allows_access_for?(required_scopes) required_scopes.any? { |scope| scopes.include?(scope) } end |
#scopes ⇒ Object
54 55 56 |
# File 'lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb', line 54 def scopes auth.fetch("scopes").map(&:to_s) end |