Module: Evvnt::Persistence
- Included in:
- Base
- Defined in:
- lib/evvnt/persistence.rb
Overview
Provides methods for saving an individual record to the API
Instance Method Summary collapse
-
#new_record? ⇒ Boolean
Is this record an unsaved/fresh record?.
-
#persisted? ⇒ Boolean
Has this record been saved on the EVVNT API?.
-
#save ⇒ Object
Save this record to the EVVNT API.
Instance Method Details
#new_record? ⇒ Boolean
Is this record an unsaved/fresh record?
Returns a Boolean
14 15 16 |
# File 'lib/evvnt/persistence.rb', line 14 def new_record? unique_identifier.blank? end |
#persisted? ⇒ Boolean
Has this record been saved on the EVVNT API?
Returns a Boolean
7 8 9 |
# File 'lib/evvnt/persistence.rb', line 7 def persisted? unique_identifier.present? end |
#save ⇒ Object
Save this record to the EVVNT API
Returns Base subclass
21 22 23 |
# File 'lib/evvnt/persistence.rb', line 21 def save new_record? ? save_as_new_record : save_as_persisted_record end |