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::ITEM_TYPE, Model::LIST_NAME, Model::LIST_TYPE

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Instance Method Summary collapse

Methods inherited from Model

#as_json, #error_message, from_response, request, #response_code, #response_message, #successful?

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: )
  self.class.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