Class: Updox::Models::Patient

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

Constant Summary collapse

SYNC_ENDPOINT =
'/PatientsSync'.freeze
SYNC_LIST_TYPE =
'patients'.freeze
REMINDER_PREFERENCES =
{
  practice: 0,
  email: 1,
  home_phone: 2,
  mobile_phone: 3,
  mobile_text: 4,
  off: 5
}

Constants included from Extensions::Sync

Extensions::Sync::RECOMMENDED_BATCH_SIZE

Constants inherited from Model

Model::ITEM_TYPE, Model::LIST_NAME, Model::LIST_TYPE

Instance Attribute Summary

Attributes inherited from Model

#updox_status

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extensions::Sync

sync

Methods inherited from Model

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

Class Method Details

.exists?(patient_id, account_id:) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/updox/models/patient.rb', line 58

def self.exists?(patient_id, account_id: )
  Updox::Models::PatientMessage.exists?(patient_id, account_id: )
end

Instance Method Details

#reminder_preference=(value) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/updox/models/patient.rb', line 44

def reminder_preference=(value)
  if Updox::Models::Patient::REMINDER_PREFERENCES.include?(value)
    self[:reminderMethodId] = Updox::Models::Patient::REMINDER_PREFERENCES[value]
  else
    self[:reminderMethodId] = value
  end

  self
end

#save(account_id:) ⇒ Object



54
55
56
# File 'lib/updox/models/patient.rb', line 54

def save(account_id: )
  self.class.sync([self], account_id: )
end