class BookingsyncApplication::Controllers::BookingsyncUniverseApiAccess::AuthorizationScope

Attributes

response_hash[R]

Public Class Methods

from_response(response) click to toggle source
# File lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb, line 46
def self.from_response(response)
  new(JSON.parse(response.body))
end
new(response_hash) click to toggle source
# File lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb, line 50
def initialize(response_hash)
  @response_hash = response_hash
end

Public Instance Methods

account_id() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb, line 54
def scopes
  auth.fetch("scopes").map(&:to_s)
end

Private Instance Methods

auth() click to toggle source
# File lib/bookingsync_application/controllers/bookingsync_universe_api_access.rb, line 68
def auth
  @auth ||= response_hash.fetch("auth")
end