Class: Updox::Models::User

Inherits:
Model
  • Object
show all
Extended by:
Extensions::Exists
Defined in:
lib/updox/models/user.rb

Constant Summary collapse

SAVE_ENDPOINT =
'/UserSave'.freeze
QUERY_ENDPOINT =
'/UserList'.freeze
FIND_ENDPOINT =
'/UserGet'.freeze
LIST_TYPE =
'userList'.freeze
LIST_NAME =
'users'
ITEM_TYPE =
'user'

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extensions::Exists

exists?

Methods inherited from Model

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

Class Method Details

.find(user_id, account_id:) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/updox/models/user.rb', line 49

def self.find(user_id, account_id: )
  response = request(endpoint: FIND_ENDPOINT, account_id: , body: { userId: user_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)

  if response.successful?
    response
  else
    nil
  end
end

.queryObject



59
60
61
# File 'lib/updox/models/user.rb', line 59

def self.query
  request(endpoint: QUERY_ENDPOINT, required_auths: Updox::Models::Auth::AUTH_APP)
end

Instance Method Details

#create(account_id:) ⇒ Object



45
46
47
# File 'lib/updox/models/user.rb', line 45

def create(account_id: )
  self.class.request(endpoint: SAVE_ENDPOINT, body: self.to_h, auth: {accountId: }, required_auths: Updox::Models::Auth::AUTH_ACCT)
end