lib/vis/api.rb in omniauth-vis-0.1.1 vs lib/vis/api.rb in omniauth-vis-0.1.2

- old
+ new

@@ -1,8 +1,10 @@ # Vipassna Identity Server Service - for server to server Oauth 2 client_credentials grant flow # gets tokens so we can use the VIS API module Vis + class OauthError < StandardError + class Api def initialize(server_url: "https://identity.dhamma.org", client_id:, client_secret:) @client_id = client_id @client_secret = client_secret @vis_app_url = server_url @@ -22,10 +24,10 @@ # we can catch VisOauthErrors in our code if we decide to use VIS API as part of any request flow or backend task private def check_error!(response_code, response_body_hash) return unless response_body_hash["error"].present? || !response_code.in?(["200", "202"]) # 201 ? - raise Exceptions::VisOauthError, + raise Vis::OauthError, "#{response_code} Error requesting token from Vipassana Identity Server. "\ "#{response_body_hash['error']} #{response_body_hash['error_description']}" end private def token_post