Class: DocuSign::Notification

Inherits:
DocuSignModel show all
Defined in:
lib/docu_sign/notification.rb

Constant Summary collapse

ATTRIBUTES =
[:use_account_defaults, :reminders, :expirations]

Instance Method Summary collapse

Methods inherited from DocuSignModel

#method_missing

Constructor Details

#initialize(attributes = {}) ⇒ Notification

Returns a new instance of Notification.



8
9
10
11
12
# File 'lib/docu_sign/notification.rb', line 8

def initialize(attributes = {})
  ATTRIBUTES.each do |attr|
    self.send("#{attr}=", attributes[attr])
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DocuSign::DocuSignModel

Instance Method Details

#to_savonObject



14
15
16
17
18
19
# File 'lib/docu_sign/notification.rb', line 14

def to_savon
  { "UseAccountDefaults" => self.,
    "Reminders" => (self.reminders.is_a?(Hash) ? {"ReminderEnabled" => self.reminders[:reminder_enabled], "ReminderDelay" => self.reminders[:reminder_delay], "ReminderFrequency" => self.reminders[:reminder_frequency]} : nil),
    "Expirations" => (self.expirations.is_a?(Hash) ? {"ExpireEnabled" => self.expirations[:expire_enabled], "ExpireAfter" => self.expirations[:expire_after], "ExpireWarn" => self.expirations[:expire_warn]} : nil)
  }.delete_if{|key, value| value.nil?}
end