Class: RubyMailman::Mailman

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_mailman/mailman.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, object, central_service) ⇒ Mailman

Returns a new instance of Mailman.



19
20
21
22
23
# File 'lib/ruby_mailman/mailman.rb', line 19

def initialize(action, object, central_service)
  self.action = action
  self.object = object
  self.central_service = central_service
end

Class Method Details

.create(obj, cs = CentralServiceInterface) ⇒ Object



7
8
9
# File 'lib/ruby_mailman/mailman.rb', line 7

def self.create(obj, cs = CentralServiceInterface)
  self.deliver(:create, obj, cs)
end

.deliver(action, obj, cs = CentralServiceInterface) ⇒ Object



3
4
5
# File 'lib/ruby_mailman/mailman.rb', line 3

def self.deliver(action, obj, cs = CentralServiceInterface)
  self.new(action, obj, cs).deliver
end

.destroy(obj, cs = CentralServiceInterface) ⇒ Object



15
16
17
# File 'lib/ruby_mailman/mailman.rb', line 15

def self.destroy(obj, cs = CentralServiceInterface)
  self.deliver(:destroy, obj, cs)
end

.update(obj, cs = CentralServiceInterface) ⇒ Object



11
12
13
# File 'lib/ruby_mailman/mailman.rb', line 11

def self.update(obj, cs = CentralServiceInterface)
  self.deliver(:update, obj, cs)
end

Instance Method Details

#deliverObject



25
26
27
# File 'lib/ruby_mailman/mailman.rb', line 25

def deliver
  Response.build(central_service.deliver(action.to_s, object))
end