We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1655d9 commit be66093Copy full SHA for be66093
lib/beyond_api/session.rb
@@ -26,11 +26,17 @@ module BeyondApi
26
autoload :WebhookSubscriptions, "beyond_api/resources/webhook_subscriptions"
27
28
class Session
29
+ class InvalidUriProtocolError < StandardError; end
30
+
31
attr_reader :api_url
32
attr_accessor :access_token, :refresh_token
33
34
def initialize(api_url:, access_token: nil, refresh_token: nil)
- @api_url = api_url
35
+ raise InvalidUriProtocolError, "Invalid URI protocol" unless api_url.start_with? "https://"
36
37
+ uri = URI.parse(api_url)
38
39
+ @api_url = "#{uri.scheme}://#{uri.host}/api"
40
@access_token = access_token
41
@refresh_token = refresh_token
42
end
0 commit comments