lib/rdstation/authentication.rb in rdstation-ruby-client-2.5.2 vs lib/rdstation/authentication.rb in rdstation-ruby-client-2.5.3
- old
+ new
@@ -1,13 +1,11 @@
# encoding: utf-8
module RDStation
class Authentication
include HTTParty
- AUTH_TOKEN_URL = "#{RDStation.host}/auth/token".freeze
DEFAULT_HEADERS = { 'Content-Type' => 'application/json' }.freeze
- REVOKE_URL = "#{RDStation.host}/auth/revoke".freeze
def initialize(client_id = nil, client_secret = nil)
warn_deprecation if client_id || client_secret
@client_id = client_id || RDStation.configuration&.client_id
@client_secret = client_secret || RDStation.configuration&.client_secret
@@ -49,11 +47,11 @@
ApiResponse.build(response)
end
def self.revoke(access_token:)
response = self.post(
- REVOKE_URL,
+ "#{RDStation.host}/auth/revoke",
body: revoke_body(access_token),
headers: revoke_headers(access_token)
)
ApiResponse.build(response)
end
@@ -77,10 +75,10 @@
def post_to_auth_endpoint(params)
default_body = { client_id: @client_id, client_secret: @client_secret }
body = default_body.merge(params)
self.class.post(
- AUTH_TOKEN_URL,
+ "#{RDStation.host}/auth/token",
body: body.to_json,
headers: DEFAULT_HEADERS
)
end