Class: Jamef::Sender

Inherits:
OpenStruct
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/jamef/sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Sender

Returns a new instance of Sender.

Raises:

  • (ArgumentError)


16
17
18
19
20
# File 'lib/jamef/sender.rb', line 16

def initialize *args
  super
  raise ArgumentError, errors.first unless self.valid?
  self
end

Instance Method Details

#validate_branchObject



22
23
24
# File 'lib/jamef/sender.rb', line 22

def validate_branch
  errors.add(:jamef_branch,'Unknown branch') if jamef_branch.present? and Jamef::Branch.find(jamef_branch).blank?
end