Class: Updox::Models::Auth

Inherits:
Hashie::Trash
  • Object
show all
Defined in:
lib/updox/models/auth.rb

Constant Summary collapse

AUTH_NONE =
[]
AUTH_APP =
[:applicationId, :applicationPassword]
AUTH_ACCT =
AUTH_APP + [:accountId]
AUTH_FULL =
AUTH_ACCT + [:userId]
PING_ENDPOINT =
'/ping'
PING_APP_ENDPOINT =
'/pingWithApplicationAuth'
PING_ACCT_ENDPOINT =
'/pingWithAccountAuth'
PING_FULL_ENDPOINT =
'/pingWithAuth'

Instance Method Summary collapse

Instance Method Details

#pingObject



23
24
25
# File 'lib/updox/models/auth.rb', line 23

def ping
  UpdoxClient.connection.request(endpoint: PING_ENDPOINT, auth: self)
end

#ping_with_account_authObject



31
32
33
# File 'lib/updox/models/auth.rb', line 31

def 
  UpdoxClient.connection.request(endpoint: PING_ACCT_ENDPOINT, auth: self, required_auths: AUTH_ACCT)
end

#ping_with_application_authObject



27
28
29
# File 'lib/updox/models/auth.rb', line 27

def ping_with_application_auth
  UpdoxClient.connection.request(endpoint: PING_APP_ENDPOINT, auth: self, required_auths: AUTH_APP)
end

#ping_with_full_authObject



35
36
37
# File 'lib/updox/models/auth.rb', line 35

def ping_with_full_auth
  UpdoxClient.connection.request(endpoint: PING_FULL_ENDPOINT, auth: self, required_auths: AUTH_FULL)
end

#to_hObject



19
20
21
# File 'lib/updox/models/auth.rb', line 19

def to_h
  { auth: super.to_h }
end