Class: Updox::Models::Practice

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

Constant Summary collapse

CREATE_ENDPOINT =
'/PracticeCreate'.freeze
FIND_ENDPOINT =
'/PracticeGet'.freeze
QUERY_ENDPOINT =
'/PracticeList'.freeze
LIST_TYPE =
'practiceList'.freeze
LIST_NAME =
'practices'
ITEM_TYPE =
'practice'

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

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

Class Method Details

.exists?(account_id) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/updox/models/practice.rb', line 42

def self.exists?()
  false == self.find().nil?
end

.find(account_id) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/updox/models/practice.rb', line 46

def self.find()
  response = request(endpoint: FIND_ENDPOINT, body: {accountId: }, required_auths: Updox::Models::Auth::AUTH_APP)

  if response.successful?
    response
  else
    nil
  end
end

.queryObject



56
57
58
# File 'lib/updox/models/practice.rb', line 56

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

Instance Method Details

#createObject



38
39
40
# File 'lib/updox/models/practice.rb', line 38

def create
  self.class.request(endpoint: CREATE_ENDPOINT, body: self.to_h, required_auths: Updox::Models::Auth::AUTH_APP)
end