Sha256: b2c4b1c33e9a6699b4e7ce115ab91a639d901c28193211c097ed0909f1fd5371
Contents?: true
Size: 916 Bytes
Versions: 5
Compression:
Stored size: 916 Bytes
Contents
module TelephoneAppointments class SummaryDocumentActivity class InvalidDeliveryMethod < StandardError; end VALID_DELIVERY_METHODS = %w(postal digital).freeze PATH = '/api/v1/summary_documents'.freeze 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 def save @response = TelephoneAppointments.api.post( PATH, appointment_id: @appointment_id, owner_uid: @owner_uid, delivery_method: @delivery_method ) @response.success? end def errors @response || raise(TelephoneAppointments::UnsavedObject, 'Please save the object before accessing the errors') @response.errors end end end
Version data entries
5 entries across 5 versions & 1 rubygems