Class: Updox::Models::Application

Inherits:
Model
  • Object
show all
Defined in:
lib/updox/models/application.rb

Constant Summary collapse

OPEN_ENDPOINT =
'/ApplicationOpen'.freeze

Constants inherited from Model

Model::LIST_NAME, Model::LIST_TYPE

Instance Method Summary collapse

Methods inherited from Model

from_response

Instance Method Details

#open(account_id:, user_id:) ⇒ Object



20
21
22
# File 'lib/updox/models/application.rb', line 20

def open(account_id: , user_id: )
  Model.from_response(UpdoxClient.connection.request(endpoint: OPEN_ENDPOINT, auth: {accountId: , userId: user_id}, required_auths: Updox::Models::Auth::AUTH_FULL))
end

#url(account_id:, user_id:, base_uri: nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/updox/models/application.rb', line 12

def url(account_id: , user_id: , base_uri: nil)
  response = self.open(account_id: , user_id: user_id)

  base_uri ||= Updox.configuration.api_endpoint.split(URI.parse(Updox.configuration.api_endpoint).path).first

  "#{base_uri}/sso/applicationOpen/#{Updox.configuration.application_id}/#{response.item.dig('token')}"
end