Class: Scimaenaga::AuthorizeApiRequest

Inherits:
Object
  • Object
show all
Defined in:
app/models/scimaenaga/authorize_api_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(searchable_attribute:, authentication_attribute:) ⇒ AuthorizeApiRequest

Returns a new instance of AuthorizeApiRequest.



4
5
6
7
8
9
10
11
12
13
# File 'app/models/scimaenaga/authorize_api_request.rb', line 4

def initialize(searchable_attribute:, authentication_attribute:)
  @searchable_attribute = searchable_attribute
  @authentication_attribute = authentication_attribute

  if searchable_attribute.blank? || authentication_attribute.blank?
    raise Scimaenaga::ExceptionHandler::InvalidCredentials
  end

  @search_parameter = { Scimaenaga.config.basic_auth_model_searchable_attribute => @searchable_attribute }
end

Instance Method Details

#companyObject



15
16
17
18
19
# File 'app/models/scimaenaga/authorize_api_request.rb', line 15

def company
  company = find_company
  authorize(company)
  company
end