class TelephoneAppointments::SummaryDocumentActivity

Constants

PATH
VALID_DELIVERY_METHODS

Public Class Methods

new(appointment_id:, owner_uid:, delivery_method:) click to toggle source
# File lib/telephone_appointments/summary_document_activity.rb, line 8
def initialize(appointment_id:, owner_uid:, delivery_method:)
  raise(InvalidDeliveryMethod, delivery_method) unless VALID_DELIVERY_METHODS.include?(delivery_method)

  @appointment_id = appointment_id
  @owner_uid = owner_uid
  @delivery_method = delivery_method
end

Public Instance Methods

errors() click to toggle source
# File lib/telephone_appointments/summary_document_activity.rb, line 26
def errors
  @response || raise(TelephoneAppointments::UnsavedObject, 'Please save the object before accessing the errors')
  @response.errors
end
save() click to toggle source
# File lib/telephone_appointments/summary_document_activity.rb, line 16
def save
  @response = TelephoneAppointments.api.post(
    PATH,
    appointment_id: @appointment_id,
    owner_uid: @owner_uid,
    delivery_method: @delivery_method
  )
  @response.success?
end