class Stackify::Authorizable::AuthorizationClient
Constants
- BASE_URI
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/stackify/authorization/authorization_client.rb, line 6 def initialize super @worker = Stackify::AuthWorker.new end
Public Instance Methods
auth(attempts, delay_time= Stackify::ScheduleDelay.new)
click to toggle source
# File lib/stackify/authorization/authorization_client.rb, line 11 def auth attempts, delay_time= Stackify::ScheduleDelay.new task = auth_task attempts @worker.perform delay_time, task end
auth_task(attempts)
click to toggle source
# File lib/stackify/authorization/authorization_client.rb, line 16 def auth_task attempts begin properties = { limit: 1, attempts: attempts, success_condition: lambda do |result| result.try(:status) == 200 end } Stackify::ScheduleTask.new properties do Stackify.internal_log :debug, '[AuthorizationClient] trying to authorize...' send_request BASE_URI, Stackify::EnvDetails.instance.auth_info.to_json end rescue => exception Stackify.log_internal_error "[AuthorizationClient]: An error occured in auth_task!" end end