Add support for eventNotification

master
Guillaume Dott 2016-11-09 11:34:19 +01:00
parent 637ad6a111
commit bae4ad44d1
3 changed files with 21 additions and 0 deletions

View File

@ -12,6 +12,7 @@ require "docurest/envelope"
require "docurest/envelope/document"
require "docurest/envelope/email"
require "docurest/envelope/email_settings"
require "docurest/envelope/event_notification"
require "docurest/envelope/recipient"
require "docurest/envelope/recipient/tab"

View File

@ -35,6 +35,7 @@ module Docurest
field :custom_fields, :customFields
field :email_settings, :emailSettings, ->(value) { Docurest::Envelope::EmailSettings.new value }
field :event_notification, :eventNotification, ->(value) { Docurest::Envelope::EventNotification.new value }
association(:recipients, :envelope_id) { Docurest::Envelope::Recipient.list(guid) }
def save_recipients(resend: false)
@ -94,6 +95,7 @@ module Docurest
emailSubject: emailSubject,
emailBlurb: emailBlurb,
emailSettings: emailSettings.to_h,
eventNotification: eventNotification.to_h,
}.tap do |hash|
if documents_changed?
hash[:documents] = documents.map(&:to_h)

View File

@ -0,0 +1,18 @@
module Docurest
class Envelope::EventNotification < Docurest::Base
field :envelope_id
field :envelope_events, :envelopeEvents
field :recipient_events, :recipientEvents
field :url
field :logging, :loggingEnabled, :boolean
def to_h
{
envelopeEvents: envelopeEvents,
recipientEvents: recipientEvents,
url: url,
loggingEnabled: loggingEnabled,
}
end
end
end