From c9def052715f992a29be1f9ac848c6a37ffa41ee Mon Sep 17 00:00:00 2001 From: Arthur Ferraz dos Santos Date: Thu, 22 Aug 2024 09:10:59 -0300 Subject: [PATCH] private attributes --- lib/lightspark-client/client.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/lightspark-client/client.rb b/lib/lightspark-client/client.rb index 1aec6e1..5b4a4ef 100644 --- a/lib/lightspark-client/client.rb +++ b/lib/lightspark-client/client.rb @@ -18,8 +18,6 @@ class Client } LOGGER_TAG = "LightsparkClient" - attr_reader :client_id, :client_secret, :api_url, :logger - def initialize(client_id:, client_secret:, api_url: DEFAULT_API_URL, logger: nil) @client_id = client_id @client_secret = client_secret @@ -34,7 +32,7 @@ def request(payload) log("Payload: #{payload}") response = Typhoeus.post( - api_url, + @api_url, body: payload.to_json, headers: request_headers ) @@ -43,7 +41,7 @@ def request(payload) end def request_headers - token = Base64.encode64("#{client_id}:#{client_secret}") + token = Base64.encode64("#{@client_id}:#{@client_secret}") { "Content-Type" => "application/json", @@ -52,9 +50,9 @@ def request_headers end def log(message, level = :info) - return unless logger && looger.respond_to?(:tagged) && logger.respond_to?(level) + return unless @logger && looger.respond_to?(:tagged) && @logger.respond_to?(level) - logger.send(:tagged, LOGGER_TAG) { logger.send(level, message) } + @logger.send(:tagged, LOGGER_TAG) { @logger.send(level, message) } end def handle_response(response)